Live data from Hacker News

Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

github.com

171–180 of 192 posts

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#171
post #163

A good example of why web servers should be measured in seconds per request rather than requests per second. As you trim little tiny bits off the seconds per request, the requests per second go skyrocketing off to infinity, but unless you're doing zero work per request, that's a dubiously useful metric. 1,000,000 requests per second on what I think is an 8-core system (?) is 1/1,000,000 * 8 = 8us per request. 1,250,0…

[deleted]

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#172

Earlier quoted context omitted.

I don't really understand this criticism nor why it's "clickbait". I have 12 "unpure" python packages in production. If my app ever needs WSGI, I'll have 13.

The reason this is clickbait is because you can wrap libuv in some other language and get the same results. So what’s the purpose of this article? That a language can wrap libuv is not a new or interesting idea.

Why do people only get upset about this sort of thing when it comes to web servers? I don't see the same nitpicks when its a BLAS library, or when it uses a CUDA kernel under the hood. Obviously python is a slow language and needs the C implementation to be fast. You could say the same thing for the vast majority of the python code base.

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#173

Earlier quoted context omitted.

Python GIL is the problem for multithreading, but I think I have a solution to not need 8 DB pools, soon o will post about it. But yeah it's a waste

Oh, I have a pretty fresh news for you. https://github.com/python/peps/pull/2955

WOW that's awesome!

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#174

Good point! However, you bring in a common misconception I'm fighting with within my company for a long time. Python is not an interpreted language. There is no such thing as an "interpreted language", a language is just a set or rules and keywords. Everything you can fit into Backus–Naur form is already a language even if it doesn't have any implementation nor compiler neither interpreter. Just as a piece of evidenc…

[deleted]

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#175
post #119

Earlier quoted context omitted.

I'm so happy this is (currently) the top comment and people are starting to realize measuring perf with these well tuned micro-benchmarks is a sham.

Why is it a sham? It's useful to know that x is faster. As a user of x I don't really care if the reason it's faster is it's C++ under the hood. That's really an implementation detail for me.

Because the moment you actually write any server or business logic in Python performance drops off a cliff and it doesn't differ significantly from any of the other Python web frameworks.

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#176

I don't quite understand the corking documentation. Is this like TCP_CORK? A buffered/batch send? Can anyone point me to details? https://docs.socketify.dev/corking.html https://baus.net/on-tcp_cork/

From uWS docs basically "sends into one single syscall/SSL block", in my understanding corking is basically minimizing to much sends, so it's batching calls.

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#177

Good point! However, you bring in a common misconception I'm fighting with within my company for a long time. Python is not an interpreted language. There is no such thing as an "interpreted language", a language is just a set or rules and keywords. Everything you can fit into Backus–Naur form is already a language even if it doesn't have any implementation nor compiler neither interpreter. Just as a piece of evidenc…

We detached this subthread from https://news.ycombinator.com/item?id=34323277.

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#178
post #167

Earlier quoted context omitted.

The perf part of the tests just seems to be a microbenchmark for seeing how fast the various frameworks can parse a 30000x300 dict of strings representing numbers [1]. If that is all one's application does, and can use your library in their organization/team, that's great. However a 2-3x performance boost for the parsing stage for a use case like an API call might not matter when that could be overshadowed by validat…

> a microbenchmark for seeing how fast the various frameworks can parse a 30000x300 dict of strings representing numbers [1]. Did you somehow miss all the other tests, even thought they are higher on the page? The important test is shown first: loading objects. I'm not trying to benchmark my wifi or my disk. The IO time is not included there on purpose. Of course a bigger application that does other things wouldn't s…

I read all the perftests in the repo. I think they nearly all parse a structure that contains a repetition of the same or similar thing a couple hundred thousand times times and the timing function returns the min and max of 5 attempts. I just picked one example for posting.

Not a Python expert, but could the Pydantic tests be possibly not realistic and/or misleading because they are using kwargs in __init__ [1] to parse the object instead of calling the parse_obj class method [2]? According to some PEPs [3], isn't Python creating a new dictionary for that parameter which would be included in the timing? That would be unfortunate if that accounted for the difference.

Something else I think about is if a performance test doesn't produce a side effect that is checked, a smart compiler or runtime could optimize the whole benchmark away. Or too easy for the CPU to do branch prediction, etc. I think I recall that happening to me in Java in the past, but probably not happened here in Python.

[1] https://github.com/ltworf/typedload/blob/37c72837e0a8fd5f350...

[2] https://docs.pydantic.dev/usage/models/#helper-functions

[3] https://peps.python.org/pep-0692/

Re: Show HN: Socketify.py: Http/Https and WebSockets servers for PyPy3 and Python3

#180
post #140

Earlier quoted context omitted.

Last I checked, Pypy wasn’t compatible with many important packages in the Python ecosystem. As of a couple years ago, there was no trustworthy, supported package for talking to a Postgres database with Pypy because psycopg2 wasn’t supported.

I've been using PyPy and psycopg2cffi in production for the last 5-6 years or so without any issues. https://pypi.org/project/psycopg2cffi/

Interesting. I wasn't able to get that working when I tried several years ago. I forget the specific issue.
Post reply on HN