Search code examples
phpfile-uploadf5

Connection reset load balancer on uploading file size greater tha 10GB


I am currently working on a requirment where we require to upload file of size 10 GB or greater.As per the requirment first of all file need to uploaded in server .Then need to be transfered to A FTP server . Once the file is completely transfered to FTP location .It need to trigger a mail.

I have done all the required php and server configuration setting for uploading file size greater than 10GB and through host IP i am able to successfully upload the file .However when i upload the same file to the same host via load balancer.The connection used to time out.Once file is transferred to FTP location.

After a bit of investigation i did found that load balancer was timing out as when php script is executing the server and it takes more time server becomes idle and there is no TCP connection communication between load balancer and server.Currently, the ideal time out for load balancer was set as 5 minutes.

Most probably this issue could be resolved.If we increase the load balancer timeout .But i would not be an appropriate solution.

My concern is there anyway in PHP through which we keep the TCP connection between server and loadbalancer can be kept ALive ?

  • PHP VERSION IS 5.6
  • APACHE 2.2
  • LOAD BALANCER F5

Any suggestion would be appreciated as i am scratching my head for 4 days.And your suggestion can save me from going bald...


Solution

  • This is a common issue because of the 2 channel method of FTP. If idle timeout is 5 minutes, the supported recommended method is still bump up the idle timeout. The RFC5382 states ".. a large idle-timeout motivated by recommendations in [RFC1122] can reduce the chances of abandoning a live session".

    Option 1 is to bump the idle timeout by a minute or however long your 10GB transfer needs JUST for this virtual server (assuming you have 1 virtual server listening on port 21 for this application).

    Option 2 Set a keep alive for the BIG-IP to server that's shorter than the TCP profile's timeout. Is this RFC? No. Would it work? Probably. These are usually used for long term connections (databases/mainframes) where idle sessions shouldn't be broken for hours and hours. This isn't really your scenario but would work.

    I recommend just bumping the idle timeout to however many minutes it takes to upload 10GB. If your virtual server handles traffic outside of port 21, you can change TCP profiles via iRules so you'd end up having a variable idle timeout based on port. Below is a good example of your question on F5's DevCentral community.

    IDLE timeout and Keepalive Interval @ DevCentral