Weblogs: Intelligent Agents

Multithreading Socket Confessions

Friday, May 23, 2003

I've run into a solid brick wall in regard to proxying requests. I have a working multithreaded server where each thread processes requests sequentially. The logic is neat and tidy, except for some reason Internet Explorer (the browser I've configured to use the proxy server) is very sluggish at sending requests - or should I say there seems to be a most definite pause before my server receives the next request from MSIE.

More than anything, its probably my lack of experience with multithreading and thread control, and socket programming that's largely to blame for my inability to solve this frustrating problem. There could be a number of factors that are causing this slowness:

So how do I resolve this? I can probably eliminate VAJ as the cause by running my application outside of it. Although I am logging to stdout at regular events, its possible that this may be delayed so it only looks like the problem is in the connection listener. So it would be best for me to include a timestamp for each log entry and I can determine from that if the delay is where it seems to be.

As for the threading, I'm going to have to find better resources. I've winged through threading without actually understanding it, and without an idea of how time-slices are managed. I'm guessing (hoping) that time is allocated evenly through threads by default, and this may not be the case.

One practical solution is to use someone else's proxy server, like Surfboard. Had a brief glance at that and although it is written completely in java, its using a shell script for start-up, which means it may not be all that trivial to run under windows, especially when it comes to the location of the default configuration file.

Or maybe Java is just too slow for what I need or expect.


[ Weblog | Categories and feeds | 2011 | 2010 | 2009 | 2008 | 2007 | 2006 | 2005 | 2004 | 2003 | 2002 ]