   Shared memory vs. loopback vs. DB?
  I'm dividing my app up into a server/client setup, where the server generates data and the client reads it. The idea is that I don't want the data generating part of my code to have to run on the same machine as the data receiving part anymore. So sockets seemed a natural way to do this. When the server and client are on the same machine, I just use the loopback 127.0.0.1 interface.This works OK, but when the server and client are on the same machine it's WAY slower than it was before when the generator part just directly passed the receiver part a pointer. So I'm looking into special casing it so that when the server and client are run on the same machine, shared memory is used instead of sockets. But I haven't been able to find any crossplatform way of doing this. Is there a good crossplatform library/wrapper somewhere?I'm a bit new to network coding, so I'm also curious, is this the sort of situation where using a database is a good idea? Some googling revealed that berkeley DB has some shared memory support, but I'm not sure if that's for what I'm trying to do or something else entirely.Any help appreciated,Jengu   
  Do you mean fastest way to process communication ?I wrote some test and can order of fastest way. 1) Shared Memory with semaphores  (fastest)2) Doors3) Pipe4) messages5) Sockets:   a) named   b) UDP   c) TCP (slowest) ;  If you're using TCP, make sure you set the TCP_NODELAY socket option. If that's not yet set, that's your problem.However, if your messages are fairly small, and very frequent, then any division of the process will cause a slowdown because of the communications overhead. Nothing is free. You'll get better performance by just using multiple threads on a single core. However, there is an upper limit to the scalability of multi-core solutions, so splitting it into multiple processes may reduce the per-node performance, but allow you to scale to more nodes, thus handling more aggregate load (at a significantly higher machine cost, of course).Last, are you SURE you need to make this change? Is that the goal of your overall project, or is it just a siren, tempting you off the charted course?   ;  Can I get a speedup when they're on the same machine if I send large chunks at once?   ;  For the same machine, it's usually fastest to keep everything in memory in one process, perhaps spawning one thread per machine processor/core, if you are compute bound. Networking would just add overhead.   