hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Tuesday

2006.04.25

High Performance WEBrick on BSD #

by why in inspect

Here’s a great hack by Eric Hodel: High Performance WEBrick (at the very bottom.) Which leverages his socket_sendfile and socket_accept_filter hacks to speed things up through system calls. Although he says these currently work only on BSD, you could probably swap in the sendfile gem, which is supported on Linux. (Found among the great stuff littered throughout ozmm’s tumblecast of the Silicon Valley conference.)

Speeding Up Net::HTTP, OpenURI or Any Other TCPSocket Offspring #

by why in bits

Only if you’re doing lots of requests amongst threads and you notice that the opening of the socket is blocking everything.

 require 'resolv-replace'

And if you are, then it’s the Matz’ pajamas.

From his own tongue:

I’m sorry if you feel offended, it’s not my intention. But if getaddrinfo() on your system does not work as you expect, I’m not the right person to report. The only workaround I can think of is to use “resolv-replace”, which is pure Ruby resolver. It is not fast at all, but at least other thread can work during resolving.

For an example, see Josh Harvey’s code.