Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TIdTcpServer performance: TIdSchedulerOfThreadPool


This question is not answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Apr 26, 2017 6:27 AM Last Post By: Vincent V.
Vincent V.

Posts: 10
Registered: 1/2/10
TIdTcpServer performance: TIdSchedulerOfThreadPool  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 19, 2017 3:52 PM
Hi,

I have a server application with a TIdTCPServer, and currently 350 clients are connecting to this server (and each client can open extra temporary dataconnections ). Right now, when I have to do a restart of my application, all 350 clients connect at the same moment. With TIdTCPServer creating a thread for every connection this causes 350 threads to be created at once (putting load on the main thread I assume) and once connected, each connection needs to get authenticated which takes a little more CPU time (but this time from the connections's thread). Anyway, the user interface becomes non responsive during 60" right after startup, I think the main reason is the thread creation.

For the future, this number of connections will continue to grow, so I think that having a thread per connection is not the best option anymore?
Is it possible to run a TIdTCPServer with 350 concurrent (permanent) connections while only having 100 threads? Is this what TIdSchedulerOfThreadPool (or TIdSchedulerOfThreadDefault) would do? Or are they caching threads instead of destroying them, and will I still have 350 threads for my 350 connections? What's an 'acceptable' maximum number of threads a server should have nowadays?

Right now, I experimented by increasing the TIdTCPServer.MaxConnections by 5 each second until it reaches 300. This works fine, but is there a better solution?

Thanks for any advice!
Vincent

(PS: I found a very similar question here ( [https://forums.embarcadero.com/message.jspa?messageID=696924|https://forums.embarcadero.com/message.jspa?messageID=696924] ) , but my questions were not exactly the same and the topic was from 2015 so I posted a new topic).

Edited by: Vincent V. on Apr 26, 2017 12:48 AM

Vincent V.

Posts: 10
Registered: 1/2/10
Re: TIdTcpServer performance: TIdSchedulerOfThreadPool  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 26, 2017 5:03 AM   in response to: Vincent V. in response to: Vincent V.
Anyone? Or is this the wrong forum for Indy related questions?

Edited by: Vincent V. on Apr 26, 2017 5:04 AM
Lajos Juhasz

Posts: 801
Registered: 3/14/14
Re: TIdTcpServer performance: TIdSchedulerOfThreadPool [Edit]
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 26, 2017 6:02 AM   in response to: Vincent V. in response to: Vincent V.
Vincent V. wrote:

Anyone? Or is this the wrong forum for Indy related questions?

Edited by: Vincent V. on Apr 26, 2017 5:04 AM

The best place to ask this question is of course the winsock forum:
embarcadero.public.delphi.internet.winsock
Vincent V.

Posts: 10
Registered: 1/2/10
Re: TIdTcpServer performance: TIdSchedulerOfThreadPool [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 26, 2017 6:27 AM   in response to: Lajos Juhasz in response to: Lajos Juhasz
Lajos Juhasz wrote:
Vincent V. wrote:

Anyone? Or is this the wrong forum for Indy related questions?

Edited by: Vincent V. on Apr 26, 2017 5:04 AM

The best place to ask this question is of course the winsock forum:
embarcadero.public.delphi.internet.winsock

ok, thanks!
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02