[Twisted-Python] twisted socksv4 proxy
Yun Mao
maoy at cis.upenn.edu
Wed Sep 24 17:20:16 EDT 2003
OK. Here are some numbers:
First, I tried the bandwidth to download kernel from kernel.org: around
150K/s reported from wget.
Then,
I wrote a little program to use twisted.protocols.socks:
application = Application("socks4 proxy")
application.listenTCP(1080, socks.SOCKSv4Factory("/tmp/socks.log"))
if '__main__' == __name__:
application.run()
I start the program on my own machine, port 1080.
After that I use a "sockify" program (tsocks) to use the "127.0.0.1:1080"
proxy to download. wget told me the speed is 4.10K/s Ideally, a proxy on
localhost should bring almost 0 overhead, right?
I also observe 100% cpu usage. A faster CPU may get better results. But,
still, what is going on here?
I modified socks.py and tried the producer idea, but it doesn't work.
Maybe because the wrong usage?
Somebody can help me out? Thanks a lot!
> Twisted will merrily buffer as much data as necessary if the connection
> isn't ready for writing. Unless you are talking about very large amounts of
> data, I doubt this would be a serious problem. I'm guessing here though;
> real benchmarks are welcome :)
>
> Still, if it is a problem -- or you're just sufficiently concerned to care
> about it anyway :) -- you could use producers and consumers to effectively
> throttle the upstream connection (the producer) when the downstream
> connection's (the consumer) buffers are full. Probably something like
> twisted.protocols.pcp.ProducerConsumerProxy would help here.
>
> -Andrew.
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
--
Yun Mao
Ph.D Student, University of Pennsylvania
http://www.cis.upenn.edu/~maoy/
More information about the Twisted-Python
mailing list