I have been struggling with this issue for 4 days now. Recently We migrated our DC to Cloud. After that we are facing this issue when a query is sent from a remote machine it stays in the "writing to net" state for a long peroid of time(from 1200 - 3000 seconds). When I run the same query in the localhost it returns the results within seconds.
I have tweaked few server variables like net_read_timeout and net_write_timeout but this is of no use.
Server Configuration: MySQL Community version 5.1.69 CentOS release 6.4 KERNEL version : 2.6.32-358.el6.x86_64(This is very old Kernel version maybe this is causing the whole problem)
Any Kind of Help would be deeply appreciated.