[pylons-discuss] Re: Waitress and multiprocess pooling

2022-05-12 Thread Jonathan Vanasco
- What's the recommended modern multiprocess enabled web server to do more 
scaleable Pyramid hosting?

I like uWSGI, but others like gunicorn and I think there is another popular 
option. 

Regardless of the server you choose, please be aware they may (though I am 
pretty sure they all will) all cause issues with your current codebase due 
to the characteristics of copy-on-write memory optimization.  Usually the 
issues I've seen are with database connections and random seed generators.  
Most of the libraries you are probably using will support correcting this 
with specific calls to make after the process forks.  If you're using 
SqlAlchemy, look at Engine.dispose() and most crypto libraries have an 
`atfork` function. 

I just wanted to put that on your radar now, so you can audit your code for 
this stuff if you decide to switch your deployment.

On Thursday, May 12, 2022 at 4:46:55 PM UTC-4 mi...@redinnovation.com wrote:

> Hi,
>
> I am running a Pyramid based website and now traffic is picking up. I feel 
> I might bump the problems of Waitress scalability soon. As far as I 
> understand, Waitress does not offer multiple process pooling modes, only 
> threading. This, combined with Python GIL, might cause problems if requests 
> start to be more and more CPU bound. 
>
> - Am I correct and Waitress is limited by Python threading?
>
> - What's the recommended modern multiprocess enabled web server to do more 
> scaleable Pyramid hosting?
>
> Thank you,
> Mikko
>
> Ps. Site is here, also we are hiring if anyone is looking for gigs or jobs 
> in Pyramid + SQLAlchemy:
>
> https://tradingstrategy.ai/
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/20f1a129-1853-412b-a707-ebeb11db10e2n%40googlegroups.com.


Re: [pylons-discuss] Re: Waitress and multiprocess pooling

2022-05-13 Thread Mikko Ohtamaa
>
> Regardless of the server you choose, please be aware they may (though I am
> pretty sure they all will) all cause issues with your current codebase due
> to the characteristics of copy-on-write memory optimization.  Usually the
> issues I've seen are with database connections and random seed generators.
> Most of the libraries you are probably using will support correcting this
> with specific calls to make after the process forks.  If you're using
> SqlAlchemy, look at Engine.dispose() and most crypto libraries have an
> `atfork` function.
>

Thank you Jonathan. This is golden, rarely seen, insight.

Br,
Mikko

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAK8RCUsLPsfw7AMzf2T5GJUrt6BdTeo9FW9Tyf0g46XCLES%3DKg%40mail.gmail.com.


Re: [pylons-discuss] Re: Waitress and multiprocess pooling

2022-05-16 Thread Thierry Florac
I personally use Apache with mod_wsgi, in multi-processes mode (from 1 to
16, based on vCPU count).
I know it's probably not the most "modern" option, but I know it, it works
pretty well and I didn't notice any problem (I use a PostgreSQL ZODB with
RelStorage and SQLAlchemy together).
I also used GUnicorn for a while, but only for async-based applications...

Best regards,
Thierry
-- 
  https://www.ulthar.net -- http://pyams.readthedocs.io


Le ven. 13 mai 2022 à 00:14, Jonathan Vanasco  a écrit :

> - What's the recommended modern multiprocess enabled web server to do more
> scaleable Pyramid hosting?
>
> I like uWSGI, but others like gunicorn and I think there is another
> popular option.
>
> Regardless of the server you choose, please be aware they may (though I am
> pretty sure they all will) all cause issues with your current codebase due
> to the characteristics of copy-on-write memory optimization.  Usually the
> issues I've seen are with database connections and random seed generators.
> Most of the libraries you are probably using will support correcting this
> with specific calls to make after the process forks.  If you're using
> SqlAlchemy, look at Engine.dispose() and most crypto libraries have an
> `atfork` function.
>
> I just wanted to put that on your radar now, so you can audit your code
> for this stuff if you decide to switch your deployment.
>
> On Thursday, May 12, 2022 at 4:46:55 PM UTC-4 mi...@redinnovation.com
> wrote:
>
>> Hi,
>>
>> I am running a Pyramid based website and now traffic is picking up. I
>> feel I might bump the problems of Waitress scalability soon. As far as I
>> understand, Waitress does not offer multiple process pooling modes, only
>> threading. This, combined with Python GIL, might cause problems if requests
>> start to be more and more CPU bound.
>>
>> - Am I correct and Waitress is limited by Python threading?
>>
>> - What's the recommended modern multiprocess enabled web server to do
>> more scaleable Pyramid hosting?
>>
>> Thank you,
>> Mikko
>>
>> Ps. Site is here, also we are hiring if anyone is looking for gigs or
>> jobs in Pyramid + SQLAlchemy:
>>
>> https://tradingstrategy.ai/
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "pylons-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pylons-discuss+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pylons-discuss/20f1a129-1853-412b-a707-ebeb11db10e2n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAPX_VWA85Wxm%3D%3DTHSNa4HsnDr98rb%2B39JMpLcvmC73Bb0%3DkF6A%40mail.gmail.com.


Re: [pylons-discuss] Re: Waitress and multiprocess pooling

2022-05-18 Thread Mikko Ohtamaa
On Fri, 13 May 2022 at 00:14, Jonathan Vanasco  wrote:

> - What's the recommended modern multiprocess enabled web server to do more
> scaleable Pyramid hosting?
>
> I like uWSGI, but others like gunicorn and I think there is another
> popular option.
>

I decided to go with Gunicorn, because I used uWSGI extensively. Gunicorn
is somewhat easier to manage with modern Python package management tools
like Poetry, plus you do not encounter the potential issues raising from
compiling C.

So far so good, only option I missing from Gunicorn is Waitress's
"url_prefix". Is there a generic way for setting the WSGI application root
/  URL prefix that is not specific to Waitress?

Opened a StackOverflow question on this one:
https://stackoverflow.com/questions/72284506/setting-application-url-prefix-with-gunicorn

Br,
Mikko

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAK8RCUtMQwaPvG3QdrjGgpt9sB_pHb3ZHzODF_V1TN56T%2BGmOw%40mail.gmail.com.