Skip to content

Swiftense communicates due Memory Packets to Clients on the local machine.

License

Notifications You must be signed in to change notification settings

Swiftense/MemoryCommunication

Repository files navigation

MemoryCommunication

Swiftense communicates due Memory Packets to Clients on the local machine.

Why dont't just use Network Packets?

Packets sent through shared memory can be over 15x faster than Packets sent through a network socket using TCP. But furthermore a lot of times The Database server and client are on the same machine and then it makes no sense to not only waste a lot of CPU power but also loose the security advantages of network packets.

How does it work?

The Memory Server starts by opening up a Shared Memory buffer using the shmget and shmat systemcalls, and opening up an semaphore usign the sem_open systemcall. And then for sending and recieving messages a hybrid algorithm between a semaphore and a spinlock is used for the optimal balance between latency and performance.

Example

Note that this doesn't work on systems without bash, and that the GNU Compiler Collection has to be installed. Start by cloning this repository.

git clone https://github.com/Swiftense/MemoryCommunication
cd MemoryCommunication
chmod +x client.sh && chmod +x server.sh

Then you can run ./server.sh messanger and ./client.sh messanger to open a simple prompt that allows you to sent messages between client and server. But you can also run the scripts with the performance argument if you want to benchmark the performance or the count argument to just make the client and server counting.

Problems

  • Everything in this repository is under heavy development and has no gauranty to work.
  • No specific protocol is used.
  • Currently no permission Management.