Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always responds from web_1 (doesn't seem to be using other scaled containers) #2

Closed
molinto opened this issue Sep 17, 2015 · 3 comments

Comments

@molinto
Copy link

molinto commented Sep 17, 2015

Hi, trying to get my head around this. Followed your instructions:

  • Cloned repos
  • docker-compose up -d
  • docker-compose ps (shows dockercomposedemo_redis_1 / dockercomposedemo_web_1 / dockercomposedemo_lb_1)
  • curl 0.0.0.0 (shows: Hello World!, I have been seen 1 times. My Host name is 2298df0387b0)
  • docker-compose scale web=5 (shows: Creating and starting 2... done, Creating and starting 3... done
    Creating and starting 4... done, Creating and starting 5... done)
  • docker-compose up -d (shows: dockercomposedemo_redis_1 is up-to-date, dockercomposedemo_web_2 is up-to-date, dockercomposedemo_web_5 is up-to-date, dockercomposedemo_web_3 is up-to-date, dockercomposedemo_web_4 is up-to-date, dockercomposedemo_web_1 is up-to-date, dockercomposedemo_lb_1 is up-to-date)
  • curl 0.0.0.0 (5 times)
  • docker-compose logs (shows:
web_1   | 172.17.0.101 - - [17/Sep/2015 09:44:02] "GET / HTTP/1.1" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:44:02] "GET / HTTP/1.1" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:44:02] "GET / HTTP/1.1" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:44:03] "GET / HTTP/1.1" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:44:03] "GET / HTTP/1.1" 200 -

Thought I'd try ab testing it:

ab -n 1000 -c 100 http://localhost/ 

In the logs:

web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
web_1   | 172.17.0.101 - - [17/Sep/2015 09:46:09] "GET / HTTP/1.0" 200 -
etc etc

Outputted in console:

$ ab -n 1000 -c 100 http://localhost/
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        Werkzeug/0.10.4
Server Hostname:        localhost
Server Port:            80

Document Path:          /
Document Length:        73 bytes

Concurrency Level:      100
Time taken for tests:   0.884 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      228000 bytes
HTML transferred:       73000 bytes
Requests per second:    1131.11 [#/sec] (mean)
Time per request:       88.409 [ms] (mean)
Time per request:       0.884 [ms] (mean, across all concurrent requests)
Transfer rate:          251.85 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.3      0       1
Processing:    16   85  15.7     87     112
Waiting:        6   85  15.7     86     111
Total:         17   85  15.5     87     112

Percentage of the requests served within a certain time (ms)
  50%     87
  66%     92
  75%     95
  80%     97
  90%    100
  95%    105
  98%    108
  99%    110
 100%    112 (longest request)

@vegasbrianc
Copy link
Owner

Since updating Docker & Compose it is not working the same. So I added an extra flag to the up command so it rebuilds the containers after the scale.

docker-compose up --force-recreate -d

@molinto
Copy link
Author

molinto commented Sep 17, 2015

Bingo, thanks dude!
Please remember to update README & article (https://www.brianchristner.io/how-to-scale-a-docker-container-with-docker-compose/)

@molinto molinto closed this as completed Sep 17, 2015
@vegasbrianc
Copy link
Owner

Done and done! Thanks for pointing this out. Added a link to your GitHub in the article. Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants