If I start scheduler daemon in my web app, can it impact performance of my web app ?

59 views
Skip to first unread message

Stéphane Klein

unread,
Jun 16, 2012, 5:05:57 AM6/16/12
to apsch...@googlegroups.com
Hi,

if I've this source code :

from apscheduler.scheduler import Scheduler
import requests

sched = Scheduler()

@sched.interval_schedule(seconds=10)
def some_job():
    print('start')
    for a in range(1, 10):
        r = requests.get('http://www.google.fr')
        print(r.status_code)

    print('end')

sched.configure()
sched.start()

from wsgiref.util import setup_testing_defaults
from wsgiref.simple_server import make_server

def simple_app(environ, start_response):
    setup_testing_defaults(environ)

    status = '200 OK'
    headers = [('Content-type', 'text/plain')]

    start_response(status, headers)

    ret = ["%s: %s\n" % (key, value)
           for key, value in environ.iteritems()]
    return ret

httpd = make_server('', 8000, simple_app)
print "Serving on port 8000..."
httpd.serve_forever()

In this source code, do you think scheduler daemon can impact performance of the web app ?
It's is a bad idea to start scheduler in my webapp ?

Is there an issue with Global Internal Lock of Python ?

Thanks for your comments.

Best regards,
Stephane

Alex Grönholm

unread,
Jun 16, 2012, 8:02:58 AM6/16/12
to apsch...@googlegroups.com
The effect should be negligible. By the way, why do you call sched.configure() with no arguments? It doesn't do anything then.


Is there an issue with Global Internal Lock of Python ?
Global Interpreter Lock you mean? No more issues than usual.
Reply all
Reply to author
Forward
0 new messages