Posted Mon, 2 Jan 2017 21:13:43 +0100 in reply to
Inquie
Reply
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. using
TaskSemaphore
) 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
call yield()
, so that other requests/tasks can still be processed.
Ideally, the computation itself would also be done within a
runWorkerTask()
, so that the main thread stays fully available for
handling requests.