Rorcraft Blog

Using XSendFile to prevent memory leak in mongrel

When we working on the lastest project which allow user to download video that may be upto a few hundred MB, we see that the memory usage of mongrel start from 5MB in the beginning , and jump to to 300MB in a single night. After trace for a while, we found that the source of the leaking pointing to sendfile function that we currently use. So we looking for a solution to fix the memory leak , and that is the XSendFile which we are going to talk about.

Most of the people would use mongrel as the application server to deploy the rails , while using apache as the load balance proxy to forward the traffic to the servers that running mongrel. By using XSendFile, instead of mongrel load the file , and pass the file stream to apache,

Contact

We love to hear about your web projects.
Email:
Sydney: +61 421 591 943
Hong Kong:+852 6901 2682

Categories