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

CPU over 100% when queues are not empty #39

Open
matthew-gill opened this issue Dec 17, 2019 · 10 comments
Open

CPU over 100% when queues are not empty #39

matthew-gill opened this issue Dec 17, 2019 · 10 comments

Comments

@matthew-gill
Copy link

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?

@Pixel-Jack
Copy link

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

@matthew-gill
Copy link
Author

@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.

@matthew-gill
Copy link
Author

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

@Pixel-Jack
Copy link

@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 :)

@rciorba
Copy link

rciorba commented Mar 25, 2020

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.

@xdxiaodong
Copy link

+1

@brendandebeasi
Copy link

@rciorba Any update on this?

@ucarbehlul
Copy link

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)?

@rciorba
Copy link

rciorba commented Mar 14, 2022

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

@ronster37
Copy link

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

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

7 participants