On Mon, 2 Jan 2017 21:13:43 +0100, Sönke Ludwig wrote:
Am 02.01.2017 um 18:15 schrieb Inquie:
What is the maximum number of restful commands that can be queued? For each one I do quite a bit of work which takes several minutes sometimes. I see that I can queue up several of them with no problem but I do not know how safe this is and if I need to actually write a separate queuing routine.
Each command is around 1k bytes. What happens if I do to many? Crash, drops, or is it safe?
It depends on what the handler does exactly. If they allocate a lot of
memory, it may be necessary to implement an explicit limit (e.g. usingTaskSemaphore
) to keep the process from running out of memory.
Otherwise, basically any number of concurrent requests should be fine.If there are lengthy CPU computations involved, these should regularly
callyield()
, so that other requests/tasks can still be processed.
Ideally, the computation itself would also be done within arunWorkerTask()
, so that the main thread stays fully available for
handling requests.
I download a file using wget since download() didn't work on the links(see the bug post I mentioned with the pastebin link...).
I can't yield with wget but I could run it in a task. I tried the queuing quite a bit of rest calls and it did them all so I guess it works fine.
Thanks.