Page 1 of 1

[jQuery(ajax), Python] Is this too intense?

Posted: Sun Sep 02, 2012 10:28 am
by Isaac
Back end:
I have a loop on the server. It checks for updates in a file every second and sleeps. It loops twenty times then ends the script. Any new updates get returned to the user's browser.

Front end:
There's a javascript loop that uses ajax to call for an update from the server, then waits. If it fails or succeeds it waits for a whole second then loops. A success has new lines that get posted in the html.

I'm worried that having the server recheck a file every second is too demanding, especially when multiple browsers are using the same script.

Re: Is this too intense?

Posted: Sun Sep 02, 2012 4:10 pm
by Jeff250
What does "checks for updates in a file" consist of? Reading the file in its entirety? Checking the file's last-modified date? If the latter, you're probably fine. If the former, reading a growing file in its entirety won't scale.

P.S. Use a database already. :P

Re: Is this too intense?

Posted: Sun Sep 02, 2012 5:12 pm
by Isaac
I was using MySQL. The issue is my provider keeps deleting my freaking lib to access it.

I guess I'll just ask him today to put it back.

Re: Is this too intense?

Posted: Sun Sep 02, 2012 9:49 pm
by Jeff250
The MySQL python bindings? Are you installing them somewhere in $HOME?

Re: Is this too intense?

Posted: Mon Sep 03, 2012 9:03 am
by Isaac
Oh no, he's installing them in where ever they're suppose to go. The problem we get a system upgrade every year, so far, and each time I've had to ask him to re install them.

I don't have ssh terminal access so I have to hound him whenever I need something.