From experts advice here on the Forum, and what I have read on the subject, constant cycling of an idle looping server slows down everything else running on that computer.
No doubt someone has a better idea than this, or has invented it already, but what do you think?
My server could just do one pass and complete all its duties. Then run a separate program and exit.
The separate program has a wait state so it is effectively asleep for a time and then checks to see what work has come in for the server to process. In my case, if it is more than X number of files then the program loads and runs the server and terminates.
The wait state can subsequently become shorter or longer based on the flow of incoming files.
I don't know what waste or overhead restarting programs has other than the initialisation of variables, so I look forward to your advice and ideas.
Thank you.
Server loop avoidance.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9663
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Server loop avoidance.
Hi.
Are you familiar with "sending in time"? It is rarely advisable to use "wait", except in very isolated and well compartmentalized cases.
Check out the "send" command in the dictionary.
If you do use "send", then the overhead and other troubles are likely not overly onerous, at least no more so than the code you are executing.
Craig Newman
Are you familiar with "sending in time"? It is rarely advisable to use "wait", except in very isolated and well compartmentalized cases.
Check out the "send" command in the dictionary.
If you do use "send", then the overhead and other troubles are likely not overly onerous, at least no more so than the code you are executing.
Craig Newman
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Server loop avoidance.
I agree with Craig, LC has the feature you need built in, so there's no reason to make it more complex. If you do decide to use a second app, you'll have the same problem. The wait command is blocking and can affect the rest of the server as well, so you'd need to use "send" there too.
Rule of thumb is to avoid the wait command for long, ongoing processes. At the very least, use "wait with messages".
Rule of thumb is to avoid the wait command for long, ongoing processes. At the very least, use "wait with messages".
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 9837
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Server loop avoidance.
Use a request-and-reply protocol like HTTP and you never need to worry about how to handle this on the server.
If you choose HTTP specifically, you also get a vast universe of tooling, docs, and standardization as well.
If you choose HTTP specifically, you also get a vast universe of tooling, docs, and standardization as well.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Server loop avoidance.
Thank you all for the well received advice.
I think that is the answer.
I think that is the answer.