this is how my server code looks.....
I need to connect 5000 client with the server emitting messages to all every 10 seconds
Right now i am able to connect 200 connections, after that
clients are getting disconnected because of high cpu usage
I have 2 core machine with 3.7 gb ram
import uvicorn
import asyncio
import socketio
url='url'
channel='public_chat'
mgr = socketio.AsyncRedisManager(url=url, channel=channel, write_only=False)
sio = socketio.AsyncServer(async_mode='asgi',client_manager=mgr, async_handlers=True, logger=True, engineio_logger=True)
app = socketio.ASGIApp(sio)
@sio.on('connect')
async def test_connect(sid, environ):
print('connected', sid)
@sio.event
async def message(sid, message):
await sio.emit('client', message)
@sio.on('disconnect')
async def test_disconnect(sid):
print('Client disconnected')
if name=='main':
uvicorn.run(app, host='0.0.0.0', port=61431)
this is how my server code looks.....
I need to connect 5000 client with the server emitting messages to all every 10 seconds
Right now i am able to connect 200 connections, after that
clients are getting disconnected because of high cpu usage
I have 2 core machine with 3.7 gb ram
import uvicorn
import asyncio
import socketio
url='url'
channel='public_chat'
mgr = socketio.AsyncRedisManager(url=url, channel=channel, write_only=False)
sio = socketio.AsyncServer(async_mode='asgi',client_manager=mgr, async_handlers=True, logger=True, engineio_logger=True)
app = socketio.ASGIApp(sio)
@sio.on('connect')
async def test_connect(sid, environ):
print('connected', sid)
@sio.event
async def message(sid, message):
await sio.emit('client', message)
@sio.on('disconnect')
async def test_disconnect(sid):
print('Client disconnected')
if name=='main':
uvicorn.run(app, host='0.0.0.0', port=61431)