Make sure your not sorting the emails that can cause the connection to timeout, http://trac.roundcube.net/wiki/Howto_Performance