c++ - Multithread webservice? -


i need write program calculation intensive. need load data database memory before calculation (to save time fetching data database each time.

i want program webservice, , want many clients able run multiple calcuations @ same time.

since load data takes quite memory, want calculations sharing same data(global data).

however, if 2 users call loading same data @ same time, there synchronization issue, when 1 loading data, , 2nd begin load same data again.

do need thread lock this? webservice mean multi-thread programming? plan use wws(windows web service), since c++ programmer, handled pure algorithms before, new me.

sorry if confuse you.

thank much.

if able distinguish each client reliably, can create context each one, , context may expire if client disconnects or remains idle specified amount of time.

additionally, if want allow each client multiple "calculation requests" simultaneously, need unique way identify each of these requests, , keep track of them in client context. example, if user has 1 processing task, , 2 queued tasks, context tracking 3 tasks simultaneously, , each of them has own state (queued, running, , completed).

to identify when "calculation request" done processing, client stay polling service, informing unique identifier "calculation request" it's interested in.

whether locking required or not, depends on architecture adopt solve problem. "global data" read-only? if yes, don't need lock access it. otherwise, (still depends on how data stored). suggest using http web service, , rely on sessions (cookies) track each user. since don't know requirements, shot in dark. if follow design suggest here, , going use thread-per-connection, you'll need @ least 1 lock per context (given user may send multiple requests simultaneously) , 1 lock guard access context list.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -