Author Topic: TFPHTTPServer limit speed  (Read 229 times)

LemonParty

  • Hero Member
  • *****
  • Posts: 699
TFPHTTPServer limit speed
« on: September 27, 2026, 09:07:22 pm »
Is it possible to limit the speed of responce in TFPHTTPServer? I want for example limit the speed to 1 Mb/s per 1 IP.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

rvk

  • Hero Member
  • *****
  • Posts: 7098
Re: TFPHTTPServer limit speed
« Reply #1 on: September 27, 2026, 09:16:43 pm »
I don't think this is possible by default. You should need to program this yourself by limiting the time when transmitting chunks (by adding delay).

The more important question is: why do you want to do this??

Even when limiting the speed, it might still be a problem if you have too many users (because speed of the transfer isn't the only thing the server does). In that case you might be better off installing a nginx instance in front of your TFPHTTPServer to limit speed and connections.

LemonParty

  • Hero Member
  • *****
  • Posts: 699
Re: TFPHTTPServer limit speed
« Reply #2 on: September 28, 2026, 01:23:57 pm »
Understood. Will try nginx.
Lazarus v. 4.99. FPC v. 3.3.1. Windows 11

Hobbit00

  • New Member
  • *
  • Posts: 45
Re: TFPHTTPServer limit speed
« Reply #3 on: September 28, 2026, 03:00:23 pm »
You can do very simply like @rvk said (delay on chunks).
With Indy (I use it in my servers) in "OnCommandGet" event use a calculated delay between answers (calculate the bytes send for the last time check).

There is no issue using sleep, since you use one for thread connection: 1 thousand thread -> 1 thousand sleep ... and the problems eventually are not the sleep but the threads.

I used it before I update to 10 Gbit FO lines in my home and my office.

 

TinyPortal © 2005-2018