1) Disable Nagle on the socket since all queries are sent as a single string 2) Stop using sizeof("\n") to get the length of the string "\n" These need to be submitted upstream as well.