Issue regarding monkey.patch_socket()?

59 views
Skip to first unread message

Tom N.

unread,
Feb 7, 2012, 12:40:21 PM2/7/12
to gev...@googlegroups.com
Hey all,

I have been playing around with gevent. 
I just recently installed it on my windows machine, Windows 7 64-bit, Python 2.7-32 bit version installed.

It seems like in version 1.0b1, monkey.patch_socket() does not seem to work?

Here's my sample code: https://gist.github.com/1760932

If I use monkey.patch_socket(), it seems as if the urllib2 requests are sent serially, one after another? It's taking upto ~30 seconds to finish.
However if I use from gevent import socket, the script finishes in roughly 4 seconds. 

Does anyone know what's the issue? Or is this just an installation problem on my end?

Regards,
Tom

Denis Bilenko

unread,
Feb 8, 2012, 12:39:09 AM2/8/12
to gev...@googlegroups.com
On Wed, Feb 8, 2012 at 12:40 AM, Tom N. <tai...@gmail.com> wrote:
> I have been playing around with gevent.
> I just recently installed it on my windows machine, Windows 7 64-bit, Python
> 2.7-32 bit version installed.
>
> It seems like in version 1.0b1, monkey.patch_socket() does not seem to work?
>
> Here's my sample code: https://gist.github.com/1760932
>
> If I use monkey.patch_socket(), it seems as if the urllib2 requests are sent
> serially, one after another? It's taking upto ~30 seconds to finish.
> However if I use from gevent import socket, the script finishes in roughly 4
> seconds.

Is it repeatable?

I get this times on my linux machine:

Done in 12.0334970951
Done in 1.68513607979
Done in 1.64854383469

So there's difference between first and the rest.

Unrelated to your issue, but prefer patch_all() to patch_socket(). For
example, https urls would use ssl module and that is not patched by
patch_socket, it patched by patch_ssl. It's easier to just do
patch_all().

Tom N.

unread,
Feb 9, 2012, 12:57:53 AM2/9/12
to gev...@googlegroups.com
I ran the same code on another machine, and it does not seem to have this issue. I'm guessing it was just my installation. I will try reinstalling.

Thanks for your input (and the tip on patch_all).
Reply all
Reply to author
Forward
0 new messages