Thread: Threads vs async events

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459

    Threads vs async events

    G'day,

    Not strictly related to C programming, hence my post here. I'm currently writing a simple proxy server. Basically with my model so far, I spawn a thread per connection (there is a user-defined limit). However, I don't think that would scale too well. Plus most OSes I target only support ~100 threads per process.

    At the moment all my proxy server does is read and forward data to another socket. So my question is, would I see an advantage switching to a library such as libevent? It should make thread issues disappear, and if I needed to work with the data I could always create a worker thread.

    Just trying to get some feedback whether switching to an event driven loop with libevent is a better way to go.

    If it matters, I'm targeting both Linux and Windows. Research shows MySQL has a connection to thread ratio of 1:1 (same as my program). However my requests would most likely take much longer to serve than MySQL requests.

    Thanks,
    Zac
    Last edited by zacs7; 02-10-2010 at 03:03 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need Help: Multi-threading and Synchronization
    By Anom in forum C Programming
    Replies: 7
    Last Post: 12-08-2009, 05:34 PM
  2. Replies: 5
    Last Post: 10-17-2008, 11:28 AM
  3. problem with win32 threads
    By pdmarshall in forum C++ Programming
    Replies: 6
    Last Post: 07-29-2004, 02:39 PM
  4. Console App w/ Threads and Events?
    By sean in forum C# Programming
    Replies: 1
    Last Post: 07-02-2004, 12:16 AM
  5. Block and wake up certain threads
    By Spark in forum C Programming
    Replies: 9
    Last Post: 06-01-2002, 03:39 AM