RTC Forums
March 29, 2024, 07:55:51 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: 1 2 [3]
  Print  
Author Topic: Memory usage with many clients connected  (Read 22933 times)
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #30 on: November 07, 2018, 11:07:04 AM »

About Threads ...

You can reduce the maximum number of Threads created by the RTC Thread Pool to reduce their Memory usage (less Threads = less Memory needed for Thread Stack), but ... even though you can configure the RTC Thread Pool to keep closing Threads when they are "not in use", I strongly advise AGAINST such practice, because this is going to impose the highest negative performance penalty on your Servers at times of the highest load and would effectively make the Thread Pool useless. It would also result in higher memory fragmentation, because the Memory block used for Stack would be moving up and down all the time.

Memory used by Worker Threads when they are NOT actively working is negligible (about 1 MB for Stack), but the performance penalty you would have if you were closing them when they are "currently not used" would completely negate all the positive effects of using a Thread Pool. The whole point of a Thread Pool is to avoid performance bottlenecks caused by frequent opening and closing of Threads.

The same goes for a Database Connection Pool. It would be useless if you would keep closing "currently unused" Database Connections.
Logged
Aeter
RTC Expired
*
Posts: 36


« Reply #31 on: November 07, 2018, 11:53:01 AM »

I think basically the gateway works fine also for us with default parameters. I do not want to change them.

What I need to obtain is, for example:

6000 connections -> 250 threads
0 connections -> 0 threads

Instead now is:

6000 connections -> 250 threads
0 connections -> still 250 threads

Perhaps if we can free up threads, most of the memory allocated will be freed up too.

Logged
Aeter
RTC Expired
*
Posts: 36


« Reply #32 on: November 07, 2018, 11:55:23 AM »

Ok, I understand. But, even if threads remain allocated, they should free up their information in memory about previous connections.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #33 on: November 07, 2018, 11:55:52 AM »

I'd really like to get this discussion to an end, because my time also costs money and I've already wasted one full day discussing a topic which is completely OFF-TOPIC here. If you find an actual memory leak and can send me a simple Project to reproduce it, I will be happy to take a closer look. But ... if your main problem is that you only have 16 GB RAM on your Server, but your Gateway Project has allocated 10 GB of RAM after a full day of serving 2.000 Clients, then my answer is: GET MORE RAM. Even my phone has 64 GB RAM!
Logged
Aeter
RTC Expired
*
Posts: 36


« Reply #34 on: November 07, 2018, 11:58:50 AM »

Anyway, it does not have sense to keep a threadpool of 1000 threads in memory even if there are no connections.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #35 on: November 07, 2018, 12:01:10 PM »

Read my posts. Either change Gateway parameters, or get more RAM.
Logged
Pages: 1 2 [3]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 16 queries.