Monday, 22 August 2011

Making sure that more isn't really less

During a recent code review I came across a slightly naive approach to speeding up a group of HTTP requests - by allocating a thread to each request and setting them all to run at once.

Given that I have some responsibility for and control over the servers that these threads will be connecting to, I wasn't looking forward to each client potentially attempting to establish 20+ connections at a time.

To gain some control over the number of possible concurrent connections I have introduced a sort of connectivity manager that can be configured to permit a limited number of connections, queuing others.

I have only applied this approach for one of the several dozen operations that are exposed so far, but can already see this as being a potential area to reduce some duplication which has accumulated as a result of proof of concept code being adopted into the main project without refactoring.

No comments:

Post a Comment