HTTP Server and CPU usage

113 views
Skip to first unread message

Piyush Katariya

unread,
Feb 20, 2016, 5:15:14 PM2/20/16
to Racket Users
Does HTTP server makes use of all CPU cores of machine ? if not, how to achieve it ?


Thanks,
Piyush

Vishesh Yadav

unread,
Feb 20, 2016, 6:07:42 PM2/20/16
to racket...@googlegroups.com
It runs on single system thread, so no. Racket threads don't utilize
multi-cores. However, you can put several processes behind a reverse
proxy to utilize all your CPU cores. You do have to be careful though if
you are using continuations for managing state.
--
Vishesh

Piyush Katariya

unread,
Feb 21, 2016, 8:25:31 AM2/21/16
to Racket Users
State will be in database. So Racket server will be stateless.
Is there any library to support and manage different process in bakground. Just like we have "cluster" module in node.js

Piyush Katariya

unread,
Feb 21, 2016, 8:28:32 AM2/21/16
to Racket Users
BTW if it has Single system thread does it block IO calls by default ?

Jay McCarthy

unread,
Feb 21, 2016, 3:40:59 PM2/21/16
to Piyush Katariya, Racket Users
It does not block IO calls by default. Internally it is use
asynchronous polling APIs to cause Racket threads to wait until the
file descriptors they block on are ready.

Jay

On Sun, Feb 21, 2016 at 8:28 AM, Piyush Katariya
<corporat...@gmail.com> wrote:
> BTW if it has Single system thread does it block IO calls by default ?
>
> --
> You received this message because you are subscribed to the Google Groups "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

"Wherefore, be not weary in well-doing,
for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
- D&C 64:33

Piyush Katariya

unread,
Feb 21, 2016, 3:48:41 PM2/21/16
to Racket Users
Thanks for reply Jay.
So its sound like node.js without callbacks, thats pretty sweet !
I am wondering how efficient it is compared to libuv ?

Thanks,
Piyush Katariya

Jay McCarthy

unread,
Feb 21, 2016, 7:43:11 PM2/21/16
to Piyush Katariya, Racket Users
Indeed, it is exactly node.js without callbacks... that's what
user-level threading systems are. The callback you construct manually
in node.js is equivalent to the continuation that the threading system
constructs automatically (and that you can too with call/cc.)

--

It is definitely not as efficient as a Web server. I assume it is
similarly efficient at the level of responding to the file descriptors
polls with threads, except that the threads require more memory than
the callback pointers.
Reply all
Reply to author
Forward
0 new messages