Message from discussion
Cherrypy as production wsgi server
Date: Fri, 9 Nov 2012 14:59:37 -0800 (PST)
From: Jeffrey Melloy <jmel...@gmail.com>
To: cherrypy-users@googlegroups.com
Message-Id: <b7d74c4c-966d-494c-ba93-f8c50adfda2f@googlegroups.com>
Subject: Cherrypy as production wsgi server
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_895_6633755.1352501977424"
------=_Part_895_6633755.1352501977424
Content-Type: multipart/alternative;
boundary="----=_Part_896_25698283.1352501977424"
------=_Part_896_25698283.1352501977424
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
I'm running Cherrypy as the wsgi server in front of a flask app. How do I
start getting statistics about increasing the threading count? It serves a
lot of images that are called simultaneously from a dashboard.
from cherrypy import wsgiserver, log, _cplogging
from test_qd_web_service import app
import logging
import logging.handlers
import sys
from paste.translogger import TransLogger
from repoze.profile.profiler import AccumulatingProfileMiddleware
def run():
logger = logging.getLogger("accesslog")
acc = logging.handlers.TimedRotatingFileHandler("test.access.log",
when="midnight", backupCount = 7)
logger.addHandler(acc)
wsgi_app = TransLogger(app, logger_name="accesslog",
setup_console_handler=False)
profiled_app = AccumulatingProfileMiddleware(
wsgi_app,
log_filename='ws.profile',
discard_first_request=True,
flush_at_shutdown=True,
path='/_profile'
)
d = wsgiserver.WSGIPathInfoDispatcher({'/': wsgi_app})
server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 5050), wsgi_app,
numthreads=25)
try:
server.start()
except KeyboardInterrupt:
server.stop()
if __name__ == '__main__':
run()
------=_Part_896_25698283.1352501977424
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
I'm running Cherrypy as the wsgi server in front of a flask app. How do I s=
tart getting statistics about increasing the threading count? It serv=
es a lot of images that are called simultaneously from a dashboard.<div><br=
></div><div><div>from cherrypy import wsgiserver, log, _cplogging</div><div=
>from test_qd_web_service import app</div><div><br></div><div>import loggin=
g</div><div>import logging.handlers</div><div>import sys</div><div><br></di=
v><div>from paste.translogger import TransLogger</div><div>from repoze.prof=
ile.profiler import AccumulatingProfileMiddleware</div><div><br></div><div>=
<br></div><div>def run():</div><div><br></div><div> logger =3D=
logging.getLogger("accesslog")<br></div><div> acc =3D logging=
.handlers.TimedRotatingFileHandler("test.access.log", when=3D"midnight", ba=
ckupCount =3D 7)</div><div> logger.addHandler(acc)</div><div>&=
nbsp; </div><div> wsgi_app =3D TransLogger(app, lo=
gger_name=3D"accesslog", setup_console_handler=3DFalse)</div><div><br></div=
><div> profiled_app =3D AccumulatingProfileMiddleware(</div><d=
iv> wsgi_app,</div><div> &nb=
sp; log_filename=3D'ws.profile',</div><div> disc=
ard_first_request=3DTrue,<br></div><div> flush_a=
t_shutdown=3DTrue,</div><div> path=3D'/_profile'=
</div><div> )</div><div><br></div><div> &n=
bsp; d =3D wsgiserver.WSGIPathInfoDispatcher({'/': wsgi_app})</div><div>&nb=
sp; </div><div> server =3D wsgiserver.CherryPyWSGI=
Server(('0.0.0.0', 5050), wsgi_app, numthreads=3D25)</div><div>  =
; </div><div><br></div><div> try: </div><div=
> server.start()</div><div> except =
KeyboardInterrupt:</div><div> server.stop()</div=
><div> </div><d=
iv>if __name__ =3D=3D '__main__':</div><div> run()</div></div>=
<div><br></div>
------=_Part_896_25698283.1352501977424--
------=_Part_895_6633755.1352501977424--