pjf / WebService-HabitRPG

Access the HabitRPG API from Perl
8 stars 5 forks source link

Version 0.15 slow (like a minute slow) on Mac OS X 10.7.5 #25

Closed wizonesolutions closed 11 years ago

wizonesolutions commented 11 years ago

There exists a workaround for this which is to disable keep-alives. With the current dev version (to be released as 0.15), add the following to your ~/.habitrpgrc file:

[connection]
keep_alive=0
wizonesolutions commented 11 years ago

Yes, I've isolated it to the changes introduced in 8a6df94c0df38a598df803d20a5481dfab180a9f.

Comparing to changes in iDoneThis. Maybe they do keep-alive in a different way somehow. Because adding the keep-alive flag is literally the only change that causes this for WebService::HabitRPG on Mac.

wizonesolutions commented 11 years ago

I'll add some says to determine which request is taking the longest. idone has this implemented the same way, I see, so it's not inherently Keep-Alive doing it.

wizonesolutions commented 11 years ago

The big pause is at https://github.com/wizonesolutions/WebService-HabitRPG/blob/master/bin/hrpg#L241, my $user = $hrpg->user; So, type to say some more and narrow things down.

wizonesolutions commented 11 years ago

The problem looks like it might be in WWW:Mechanize. It isn't immediately clear what might cause that though. Maybe it's something in $req. I called the API directly with curl and /api/v1/user returned really quickly, so it's not the API call in itself.

Trying to send Connection: keep-alive and Keep-Alive: 1 manually in the curl headers doesn't reproduce the behavior either.

I'll just remove the line for now and check if you have an idea about it first. My suggestion in the near-term is to just remove it unless it was a big performance hit for you.

pjf commented 11 years ago

I've made keep-alives configurable via the config file now. They default to being on, but can be disabled with:

[connection]
keep_alive = 0
wizonesolutions commented 11 years ago

Working for me on test_obj branch.

On Sun, Apr 7, 2013 at 11:22 AM, Paul Fenwick notifications@github.comwrote:

I've made keep-alives configurable via the config file now. They default to being on, but can be disabled with:

[connection] keep_alive = 0

— Reply to this email directly or view it on GitHubhttps://github.com/pjf/WebService-HabitRPG/issues/25#issuecomment-16012059 .

pjf commented 11 years ago

Workaround implemented and documented, so closing for now.