rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.58k stars 1.16k forks source link

problem in the load testing of 1000 threads in 180 seconds #522

Open kabakan opened 5 years ago

kabakan commented 5 years ago

Hi Ruben

My name is Kanat, developer VEON LTD, Almaty, Kazakhstan.

We use the telegram library 4.1 and found a problem in the load testing of 1000 threads in 180 seconds, the response waiting time is from 5 to 20 seconds for one thread when the library tries to connect to the telegram server. At the same time, the communication channel rate is not used 1 megabit, there is no load on the communication channel.

Problems: a. In 1 second only 4 or 5 users are processed, the response time is 0.2 seconds. b. If you use the number of users over 10 per second in 1 second, then the time of the answer is more than 5 to 20 seconds

Question:

  1. Do you use the library limits on the number of threads and queues to connect to the telegram server ?
  2. Or are you planning to set limits on the thread and queues for connecting to the telegrams from the server ?
  3. Did you do load testing to check the response time of the Telegram server?

I will be very happy if you provide advice for solving the problem.

carlopantaleo commented 5 years ago

Hi Kanat,

Just to give my two cents, as far as I know, the library has no limits on requests rate. As you describe it, it seems that you are hitting Telegram Bots API limits: https://core.telegram.org/bots/faq#my-bot-is-hitting-limits-how-do-i-avoid-this

kabakan commented 5 years ago

This is not a large mailing for the distribution of the message, it is a load testing of intents of 1000 threads from the Server Docker to the Telegram Server via WebSocket

rubenlagus commented 5 years ago

Telegram servers only allow one request opened at a time and each request only allow up to 100 updates. So it is not possible to have 1000 threads running at the same time.

Chase22 commented 5 years ago

Could using Webhook solve that problem, because updates are send more frequently?

enadgermani commented 5 years ago

Telegram servers only allow one request opened at a time

Are you sure? I have to send one different message every 5 second, for about 2 minutes, at the same user. Can i do it?

rubenlagus commented 5 years ago

@siamoInPochi You can send more than one message at the same time, but only can have one getUpdates request at a time running.