Python Web Interfaces + WSGI + Eventlet (100% CPU)

I am currently working with WSGI, Eventlet and REDIS to create a websocket server. We see very high CPU usage, which I would expect with the number of connections.

We have about 2000 connections to the websocket server, which output information about once every 1m30s. The information is captured and placed in the REDIS database, if there are messages waiting for the client, then the messages are sent back in response.

Python 2.7 version

The wsgi setup looks like this: wsgi.server (eventlet.listen (('127.0.0.1', 8000), accumulated = 5000), hello_world, max_size = 5000)

I ran the eventlet lib at the beginning of the script using

import eventlet
eventlet.monkey_patch()

      

We hope to bypass any Redis-related deadlocks causing high CPU.

The server is EC2 C4 large, running Ubuntu 16.04. Amazon

Nothing else works on the server other than this script up to 100% CPU seems very high to me, but maybe my expectations are wrong.

Can anyone help with some common mistakes?

+3


source to share





All Articles