Skip to content

dmitrypol/cache_nginx_redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup

mvn clean install
docker-compose up --build -d

api1 is built using Python Flask and api2 uses Java Dropwizard. To start api2 oustide the container cd api2 and java -jar target/api2-1.0-SNAPSHOT.jar server config.yml. Check that it's is running via http://localhost:8080 and http://localhost:8081/healthcheck.

Perf benchmark

# nginx cache
./wrk http://localhost/api1
Running 10s test @ http://localhost/api1
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    23.38ms   12.61ms  71.50ms   61.52%
    Req/Sec   215.34     67.65   383.00     64.00%
  4293 requests in 10.01s, 779.60KB read
Requests/sec:    428.75
Transfer/sec:     77.86KB

# redis cache
./wrk http://localhost:5000/
Running 10s test @ http://localhost:5000/
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    65.27ms   51.33ms 472.13ms   96.54%
    Req/Sec    87.61     14.73   131.00     83.94%
  1704 requests in 10.04s, 259.61KB read
Requests/sec:    169.76
Transfer/sec:     25.86KB

Nginx

To view cache content browse to tmp/cache folder.

Redis

Use redis-cli to view cache content

About

comparing caching with Nginx and Redis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published