Eric Majerus
Eric Majerus

Reputation: 1228

Why are my localhost HTTP response times so slow?

Using localhost and Tomcat 7, I'm seeing between 600-800ms per request in Chrome Developer tools for a specific webapp. Requests are JS files, CSS files, images or the initial server response. Some responses are less than 1KB, others are over 100KB.

As a result, it's taking around 10 seconds to load one page of the webapp. When I load the same webapp on our production server, it's taking less than 1 second to load an entire page.

I'm not sure where to continue debugging the issue...

So, it has to be this particular app and it has to be locally.

Upvotes: 0

Views: 3235

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48067

I've seen such behaviour long time ago when the webserver (Apache httpd back then) was configured to make DNS lookups for logs - these took awfully long time especially when an IP could not be resolved. As it doesn't make sense for a localhost app to be orders of magnitude slower (especially when you're talking about serving static resources) I'd check for any network related issues: Database connections, logging configurations, DNS lookups, TLS server trust issues (with backends, database, LDAP or others).

I can't decide if I add this as "if everything else fails" or rather add this as "but first try this:"... you decide:

Compare the setup of your production server with your development server (localhost) and make extra extra extra sure that there's no meaningful difference.

Upvotes: 2

Related Questions