+ 2

thoughts about robust server design

I developed a windows application for my server with c++ to host a website (streaming files) and have some API endpoints. The application is designed to be super efficient be responsive under any traffic load, including DDOS attacks. Of course i have firewall rules, Cloudflare proxy and some other protections like block access if someone do direct request by server IP. The server has 4 cores and 4GB RAM and it survived L7 attacks, even without cloudflare between with the peek load of 16%. So i thinking to move to 2 cores and 2GB RAM to minimize the cost as much as possible. My application use 1 thread for every open socket, i not limit how many threads can have open at the same time. I afraid in a case of a huge attack it may open too many threads at the same time and server goes down, at the other hand if limit threads to a specific number, server will still go down as it will start denying opening more threads. Which approach you think is better? Does it matter to limit active threads or will be useless?

15th Jul 2024, 3:53 PM
john ds
john ds - avatar
1 Answer
+ 1
When designing a robust server, it's key to manage threads efficiently by using a thread pool and queuing new connections if all threads are busy to prevent overload. Instead of just upgrading a single server, consider horizontal scaling by adding more servers with load balancing. Implement rate limiting to restrict the number of requests per client and use services like Cloudflare for DDoS protection and traffic filtering. Continuously monitor CPU and memory usage, and optimize your application code and configurations for efficiency. Keep using firewalls and IP blocking to filter out malicious traffic. Balancing these strategies will help maintain performance and resilience against attacks.
1st Aug 2024, 12:05 PM
✧GHOST✧
✧GHOST✧ - avatar