I am facing an issue on docker container. Rails Application is running very slow(means pages taking too much time to load on the browsers).
Application details:
Rails Version: 4.2.0
Ruby version: 2.2.0
When I checked the status of memory by command docker stats
, it is showing that the CPU utilization is very high for the main container(1
). Sometimes it goes to 50%
of utilization.
I tried with the few configurations i.e increase the CPU
allocation for the docker, the performance get increased a little bit.
version: '3.7'
services:
selenium:
image: selenium/standalone-chrome-debug:3.141.59-krypton
ports: ['4444:4444', '5900:5900']
logging:
driver: none
redis:
image: redis:3.0.0
elastic:
image: elasticsearch:1.5.2
db:
image: postgres:9.3.10
volumes:
- ./tmp/db:/var/lib/postgresql/data
- .:/home
XYZ:
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
stdin_open: true
tty: true
volumes:
- .:/home
ports:
- "3000:3000"
depends_on:
- db
- redis
- elastic
- selenium
environment:
- REDIS_URL=redis://redis:6379/0
- ELASTICSEARCH_URL=elastic://elastic:9200/0
- SELENIUM_HOST=selenium
- SELENIUM_PORT=4444
- TEST_APP_HOST=XYZ
- TEST_PORT=3000
And I observed that the js files which are loading on browser taking too much time to load approx 1.3 min
, e.g If there are 4 js files, each file taking more that 1 min
to load
What I feel is docker is running slow on a mac machine, because the same application is running very well on Linux machine, might be I am wrong, but this is the observation which I saw.
Any help will be appreciated.
top
command – Mourantdocker-sync
actually worked on my scenario, now it much better now. But now I am facing an issue that it does not sync the latest code when I refresh the page. can you please let me know what I am missing? – Difficulty