Skip to content

I am load testing the async websocket, with emitting only one event and i am not able to connect even 1000 client to my server when i am emitting an event to all clients every 10 seconds. #963

@neerajdlh74

Description

@neerajdlh74

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions