I
I
Ilsur Gilmutdinov2019-04-14 22:07:02
Python
Ilsur Gilmutdinov, 2019-04-14 22:07:02

Asynchronous chat bot VK?

Hello. There was a problem in the process of creating a chat bot for VKontakte using Python3, aiohttp, gunicorn. The bot can't handle the ad load of 5 messages/sec. The CPU load increases to 50%, and the bot responds to each user with a delay of 5-6 seconds. The bot is powered by CallBack api. I tried many options (Flask, async, aiohttp, gunicorn workers), it all comes down to the fact that the bot responds to everyone with a huge delay of 5 seconds when loaded.
Please, is there any way to fix the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Kotenko, 2019-04-18
@ilsur_dev

It is very likely that the delay occurs on the Vk side, but you need to research in detail and look for a bottleneck. The load of 50% of the CPU is quite regular and in this case you need to look at the load on the network. Horizontal scaling will probably help (the callback api has the ability to specify multiple servers).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question