On Wed, Dec 12, 2012 at 8:22 AM, Michael Schlenker <[email protected]> wrote:

> Hi,
>
> i use twisted for some volume streaming over fat pipes (10 GE) and need
> to tweak the rcv and send buffer sizes when streaming via
> socket.setsockopt(). Otherwise Twisted spends lots of time calling the
> producer with tiny blocksizes and writing those tiny buffers to the tiny
> OS buffer. Speedup for streaming was around 40x when using a large
> buffer instead of default block and buffer sizes, so this is really needed.
>
> I'm using Twisted 12.2.
>
> It works fine when using reactor.listenTCP(), but fails when using
> reactor.listenSSL() because transport.getHandle() does not return a
> socket object in that case (i get some SSL.Connection object instead).
>

Probably the thing to do is listenTCP() rather than listenSSL(), and then:

class YourProtocol(BaseProtocol):
    def connectionMade(self):
        self.transport.getHandle().setsockopt(...)
        self.transport.startTLS(contextFactory)
        BaseProtocol.connectionMade(self)

Ideally, of course, Twisted would have an API for changing the
producer/consumer buffer sizes and corresponding OS buffers.

-- 
Itamar Turner-Trauring, Future Foundries LLC
http://futurefoundries.com/ — Twisted consulting, training and support.
_______________________________________________
Twisted-Python mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to