Knowledge Base


Knowledge Base / XFilesharing Pro / Performance tuning

Performance: 'dl.cgi' (non-direct) links causes high server-load
04/16/2012 09:45 AM

Question

On the website, sometimes the CPU or server-load is around 90% causing the server the slow. In the process manager i see this cgi file "dl.cgi" taking most of the resources.

What are the solutions to make sure this file doesn't take up a lot of resources ?

Answer

The file 'dl.cgi' is used to generate temporary speed-limited symlinks for each user downloading each file.
For example; you can set your non-premium users to download at 100KB/sec and the file itself 'dl.cgi' will create a symlink (site.com/dl.cgi/abcd/1234.filename.zip) that is capped at that speed.

If you have a lot of users downloading different files  (busy site), then this will naturally cause the CPU to reach almost 90% or 100%

Here are some solutions to help keep the CPU at reasonable levels.
- Upgrade the CPU and the RAM  (This also helps reduce file I/O bottlenecks)
or
- Upgrade to Sibsoft's Nginx-Mod & Nginx WebServer. This will dramatically free up your server resources during peak periods.   (You can still set the speed-limit for your non-premium users with nginx too.)
or
Otherwise, if you're still using Apache (web-server) and if you don't mind when your non-premium users download at full-speed. Login to your website as admin user and go here: Setting-->User Limits  and  look for the option Generate DIRECT links  and make sure each box is checked  (Free, Registered, Premium)