Re: Simple TCP proxy

2022-07-28 Thread Chris Angelico
On Fri, 29 Jul 2022 at 11:42, Andrew MacIntyre wrote: > > On 29/07/2022 8:08 am, Chris Angelico wrote: > > It takes a bit of time to start ten thousand threads, but after that, > > the system is completely idle again until I notify them all and they > > shut down. > > > > (Interestingly, it takes

Re: Simple TCP proxy

2022-07-28 Thread Andrew MacIntyre
On 29/07/2022 8:08 am, Chris Angelico wrote: It takes a bit of time to start ten thousand threads, but after that, the system is completely idle again until I notify them all and they shut down. (Interestingly, it takes four times as long to start 20,000 threads, suggesting that something in

Re: Simple TCP proxy

2022-07-28 Thread Chris Angelico
On Fri, 29 Jul 2022 at 07:24, Morten W. Petersen wrote: > > Forwarding to the list as well. > > -- Forwarded message - > From: Morten W. Petersen > Date: Thu, Jul 28, 2022 at 11:22 PM > Subject: Re: Simple TCP proxy > To: Chris Angelico > > > Well, an increase from 0.1 seconds

Re: Simple TCP proxy

2022-07-28 Thread Morten W. Petersen
Well, it's not just code size in terms of disk space, it is also code complexity, and the level of knowledge, skill and time it takes to make use of something. And if something fails in an unobvious way in Twisted, I imagine that requires somebody highly skilled, and that costs quite a bit of

Fwd: Simple TCP proxy

2022-07-28 Thread Morten W. Petersen
Forwarding to the list as well. -- Forwarded message - From: Morten W. Petersen Date: Thu, Jul 28, 2022 at 11:22 PM Subject: Re: Simple TCP proxy To: Chris Angelico Well, an increase from 0.1 seconds to 0.2 seconds on "polling" in each thread whether or not the connection

Re: Fwd: timedelta object recursion bug

2022-07-28 Thread Dieter Maurer
Please stay on the list (such that others can help, too) Ben Hirsig wrote at 2022-7-29 06:53 +1000: >Thanks for the replies, I'm just trying to understand why this would be >useful? > >E.g. why does max need a min/max/resolution, and why would these attributes >themselves need a

Re: Fwd: timedelta object recursion bug

2022-07-28 Thread Dieter Maurer
Ben Hirsig wrote at 2022-7-28 19:54 +1000: >Hi, I noticed this when using the requests library in the response.elapsed >object (type timedelta). Tested using the standard datetime library alone >with the example displayed on

Re: Fwd: timedelta object recursion bug

2022-07-28 Thread Jon Ribbens via Python-list
On 2022-07-28, Ben Hirsig wrote: > Hi, I noticed this when using the requests library in the response.elapsed > object (type timedelta). Tested using the standard datetime library alone > with the example displayed on > https://docs.python.org/3/library/datetime.html#examples-of-usage-timedelta >

Re: Fwd: timedelta object recursion bug

2022-07-28 Thread MRAB
On 28/07/2022 10:54, Ben Hirsig wrote: Hi, I noticed this when using the requests library in the response.elapsed object (type timedelta). Tested using the standard datetime library alone with the example displayed on https://docs.python.org/3/library/datetime.html#examples-of-usage-timedelta

Re: poetry script fails to find module

2022-07-28 Thread Loris Bennett
"Loris Bennett" writes: > Hi, > > The following is a little bit involved, but I hope can make the problem clear. > > Using poetry I have written a dummy application which just uses to typer > to illustrate a possible interface design. The directory structure is a > follows: > > $ tree -P

poetry script fails to find module

2022-07-28 Thread Loris Bennett
Hi, The following is a little bit involved, but I hope can make the problem clear. Using poetry I have written a dummy application which just uses to typer to illustrate a possible interface design. The directory structure is a follows: $ tree -P *.py . |-- dist |-- stoat | |--

Fwd: timedelta object recursion bug

2022-07-28 Thread Ben Hirsig
Hi, I noticed this when using the requests library in the response.elapsed object (type timedelta). Tested using the standard datetime library alone with the example displayed on https://docs.python.org/3/library/datetime.html#examples-of-usage-timedelta It appears as though the timedelta

[Python-announce] attrs 22.1.0

2022-07-28 Thread Hynek Schlawack
I’m happy to announce a new release of attrs! attrs is the direct ancestor of – and the inspiration for – dataclasses in the standard library and remains the more powerful toolkit for creating regular classes without getting bogged down with writing repetitive boilerplate code:

Re: Simple TCP proxy

2022-07-28 Thread Barry
> On 28 Jul 2022, at 10:31, Morten W. Petersen wrote: > >  > Hi Barry. > > Well, I can agree that using backlog is an option for handling bursts. But > what if that backlog number is exceeded? How easy is it to deal with such a > situation? You can make backlog very large, if that makes

Re: Simple TCP proxy

2022-07-28 Thread Chris Angelico
On Thu, 28 Jul 2022 at 21:01, Morten W. Petersen wrote: > > Well, I was thinking of following the socketserver / handle layout of code > and execution, for now anyway. > > It wouldn't be a big deal to make them block, but another option is to > increase the sleep period 100% for every 200

Re: Simple TCP proxy

2022-07-28 Thread Morten W. Petersen
Well, I was thinking of following the socketserver / handle layout of code and execution, for now anyway. It wouldn't be a big deal to make them block, but another option is to increase the sleep period 100% for every 200 waiting connections while waiting in handle. Another thing is that it's

Re: Simple TCP proxy

2022-07-28 Thread Chris Angelico
On Thu, 28 Jul 2022 at 19:41, Morten W. Petersen wrote: > > Hi Martin. > > I was thinking of doing something with the handle function, but just this > little tweak: > > https://github.com/morphex/stp/commit/9910ca8c80e9d150222b680a4967e53f0457b465 > > made a huge difference in CPU usage.

Re: Simple TCP proxy

2022-07-28 Thread Morten W. Petersen
Hi Martin. I was thinking of doing something with the handle function, but just this little tweak: https://github.com/morphex/stp/commit/9910ca8c80e9d150222b680a4967e53f0457b465 made a huge difference in CPU usage. Hundreds of waiting sockets are now using 20-30% of CPU instead of 10x that.

Re: Simple TCP proxy

2022-07-28 Thread Morten W. Petersen
Hi Barry. Well, I can agree that using backlog is an option for handling bursts. But what if that backlog number is exceeded? How easy is it to deal with such a situation? I just cloned twisted, and compared the size: morphex@morphex-Latitude-E4310:~$ du -s stp; du -s tmp/twisted/ 464 stp

Re: Simple TCP proxy

2022-07-28 Thread Morten W. Petersen
OK, I'll have a look at using something else than _threading. I quickly saw a couple of points where code could be optimized for speed, the loop that transfers data back and forth also has low throughput, but first priority was getting it working and seeing that it is fairly stable. Regards,

Re: Simple TCP proxy

2022-07-28 Thread Barry
> On 27 Jul 2022, at 17:16, Morten W. Petersen wrote: > > Hi. > > I'd like to share with you a recent project, which is a simple TCP proxy > that can stand in front of a TCP server of some sort, queueing requests and > then allowing n number of connections to pass through at a time: > >