F
F
fleksss_pod_papicha2020-07-25 05:32:45
Python
fleksss_pod_papicha, 2020-07-25 05:32:45

How to create a load on the VK bot and how best to implement asynchrony?

Is it possible to artificially create a load on the VK bot, if so, how can this be done, in the last topic a person wrote about tests and some kind of "tool" for testing, but I could not find anything about this? Or what other ways are there to test how much traffic a bot can handle? The bot is written in python using vk_api, and also uses sqlite3 to store users and their messages in the database, and the bot itself is located on pythonanywhere, and multithreading is used to implement "asynchronous" message processing and each message is processed in a separate thread. Whether a question badly to implement reception of messages through flows? If yes, why and how then would it be better to implement it? Well, the question about the artificial load of the bot remains in force,

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SKEPTIC, 2020-07-25
@fleksss_pod_papicha

There are not many options.
1) Use a library that supports asynchronous work.
2) Yuzat multithreading. When the script starts, it launches hundreds of worker threads that will perform tasks. Next, the main thread in an endless loop checks the longpool for new events and gives tasks to the workers. It can be implemented through queues, both Pythonic and third-party like RabbitMQ, although it can be done through global and list.
3) Use aiohttp and work directly with VK by sending http requests.
You can't create a load in any way. Create hundreds of VK accounts and then fool around with getting API keys, and they also need an asynchronous or multi-threaded script. So you will have to test the bot in production)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question