3

I am currently working with WSGI, Eventlet and REDIS to create a websocket server. We are seeing a very high CPU load for what I would expect with the number of connections.

We have around 2000 connections to the websocket server which push information once roughly every 1m30s. The info is captured and placed into the REDIS DB, if there any messages waiting for the client then the messages are sent back in reply.

Python version 2.7

The wsgi setup looks like the below wsgi.server(eventlet.listen(('127.0.0.1',8000),backlog=5000),hello_world,max_size=5000)

I have patched the eventlet lib at the script start using

import eventlet
eventlet.monkey_patch()

To hopefully get around any Redis related deadlocks causing high CPU.

The server is a EC2 C4 large running on Ubuntu 16.04. Amazon

Nothing else is running on the server other than this script to 100% CPU seems very high to me but perhaps my expectations are incorrect.

Can anyone help with perhaps some common gotchas?

Thomas
  • 65
  • 6
  • Does it use less CPU when you cut connections to 200? 20? How much CPU time is used by a single push? – temoto Mar 26 '17 at 20:05
  • @temoto at around 400 clients connected the CPU is around 7% on average. I think I have narrowed it down to the Redis elements even with the monkey patch they appear to be blocking perhaps. – Thomas Mar 27 '17 at 01:24
  • Show the code . – temoto Mar 28 '17 at 16:53

0 Answers0