Re: Many threads in Linux



On Dec 16, 11:50 am, llothar <llot...@xxxxxx> wrote:
My goal was to measure the overhead of using threads, so the server
does the minimum possible that lets me verify that it's basically
working. And at any rate, my real request handling involves only
parsing a line of text then sending a message to a message queue, so
it's fairly comparable.

Okay i see.

This seems to work as long as you can do the parsing and queuing in
one
time slice. So that there are only ready or idle tasks but the work of
a thread
will never be delayed by serving 100000 other threads first until it
can do some
work again. This might work well because it is a very very simple
server.


Good point. If request processing involves some system calls or memory
allocation or enqueueing into some queue protected by mutex, worker
thread can be blocked inside request processing, and things can get
bad.


Scott, you can try to insert something like this into request
processing:

// sleep 1 ms with 10% probability
if (0 == (rand() % 10)) sleep(1);


Dmitriy V'jukov
.



Relevant Pages

  • Re: update variables based on own value - critique please?
    ...  In a standard http request, ... overhead for each call and you create new lambdas with identical ... def pushed_pretty ... Parsing from and conversion to string are normally ...
    (comp.lang.ruby)
  • Re: OT: Apache, PHP & SimpleXML
    ... what they receive from my request. ... parsing what they receive, but what I'm sending and what they receive ... If you're opening a URI with special characters, ... Buggery, bugger, bugger. ...
    (uk.rec.motorcycles)
  • Request: Save PDF Attchments To Folder Location
    ... I'm by no means a programmer, and I apologise if this request is out ... but does anyone have some code handy for parsing the contents ...
    (microsoft.public.outlook.program_vba)
  • Re: multi framework problem
    ... deserialized a file that has been serialized with any framework? ... If possible mean's parsing the file and make some changes, ... Not sure if this is the same problem, but I ran into some remoting issues ... Just call up MS and request the hotfix. ...
    (microsoft.public.dotnet.framework.remoting)
  • Re: BIGGEST STEP TO TAKING HASKELL MAINSTREAM
    ... Request processing is ... more similar to functional model than to conventional OO applications: ... Seriously, though, web apps aren't as functional as you are suggesting. ...
    (comp.lang.functional)