CPU over 100% when queues are not empty
matthew-gill opened this issue · 10 comments
I think the title says it all.
using docker stats
when my queues are empty, CPU reports around 3%
If I use the following command ONCE, the CPU jumps to 130%
aws --endpoint-url http://localhost:9324 sqs send-message --queue-url http://localhost:9324/queue/my_queue --message-body "Hello, queue"
Is this a known issue? Any ideas on how to fix it?
Hey @matthew-gill , I have the same issue !
And moreover this container is constantly getting some information as input (Here Input are at 17.9GB after like 5 min of running)
docker stats:
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
ea3332804018 dev_sqs 21.41% 49.23MiB / 50MiB 98.45% 1.25MB / 21.4kB 17.9GB / 16.4kB 31
To avoid this container to overload my system, I've launch it with a cpu restriction of 0.2
In docker compose:
cpus: 0.2
mem_limit: 200M
If someone has any new idea, please share
@Pixel-Jack I ended up swapping to localstack instead of this as it supports SQS... I also needed KMS as part of my stack and it came with that, too.
Perhaps a bit heavy handed if you only need SQS, however, it seems a lot more polite with CPU usage, so maybe give it a go?
It also seems a lot more maintained than this image, too.
If it helps, here's a snippet of my docker-compose
file which uses localstack to set up SQS and create two queues:
services:
localstack:
image: localstack/localstack
ports:
- "8000:8080"
environment:
- SERVICES=sqs
- HOSTNAME=localstack
- DEFAULT_REGION=eu-west-1
volumes:
- ./docker/config/localstack:/docker-entrypoint-initaws.d
Then create the following file:
./docker/config/localstack/01-queues.sh:
#!/usr/bin/env bash
awslocal sqs create-queue --queue-name YOUR_FIRST_QUEUE_NAME
awslocal sqs create-queue --queue-name YOUR_SECOND_QUEUE_NAME
@matthew-gill Thank you, for the tip and the conf files ! I'll try this, this whole stack should be useful later so it won't be a waste :)
I suspect it's the insights node app that is doing something strange here.
I attached to the container and stopped the web app and now cpu usage is back to normal.
+1
@rciorba Any update on this?
I agree that the node app seems to be acting weird. Is there a way to make container start without the node app and only the SQS part (I can view the queue contents with aws-cli if needed)?
FYI, there's an MR which also fixes this issue: #37
As the MR isn't merged yet, you can build your own image or use one I built: https://hub.docker.com/r/rciorba/alpine-sqs
I also have been having over 100% CPU usage but clearing my queues from time to time seems to resolve my CPU usage and I'm actually able to hear other things besides just my laptop fans lol