acoustid / acoustid-server

AcoustID's web site and API
MIT License
65 stars 21 forks source link

custom ip and port for binding run_http #19

Closed umask closed 1 year ago

umask commented 12 years ago

I'm running acoustid-server under high load. In this case I noticed that run_http working only on one CPU core.

For scaling load on few cores I have patched run_http.py:

============================ --- run_http.py.bak 2012-07-20 16:33:48.632211768 +0400 +++ run_http.py 2012-07-20 17:02:25.867271849 +0400 @@ -5,6 +5,12 @@ from werkzeug.serving import run_simple from acoustid.server import make_application

+import argparse +parser = argparse.ArgumentParser() +parser.add_argument('--ip', type=str, default='127.0.0.1') +parser.add_argument('--port', type=int, default=8080) +args = parser.parse_args() + logging.basicConfig(level=logging.DEBUG)

config_path = '/etc/acoustid.conf' @@ -17,8 +23,8 @@ '/static': static_path, }

-host = '127.0.0.1' -port = 8080 +host = args.ip +port = args.port

run_simple(host, port, application, use_reloader=False, static_files=static_files)

Will be great if you submit patch in upstream.

umask commented 12 years ago

for this patch required python-argparse package in case of running on RHEL/Centos.

lalinsky commented 12 years ago

Note that you do not want to use run_http in production. This is a very simple HTTP server suitable only for development. The recommended way for production is to use uWSGI + nginx.

https://github.com/lalinsky/acoustid-server/blob/master/acoustid/wsgi.py#L4

umask commented 12 years ago

Great!

I'm running with uwsgi 1.2.4 now and all working fine.