We can simply use redis to achieve the remote communication such as:
redis.StrictRedis(host=REDIS_IP,port=PORT)
I don't know whether redis achieve the remote and local in same pattern ?
Maybe I just want to know how redis achieve network communication and inter-process communcation in different way?
If there is something wrong, please point out. Thanks
Redis can handle classical TCP sockets, but also stream oriented unix domain sockets.
TCP sockets can be used to perform both network and local inter-process communication. Unix domain sockets can only support local inter-process communication.
Both kind of sockets are materialized by file descriptors. Redis is based on an event-loop working at the file descriptor level, so it processes TCP and unix domain sockets in the same exact way (using the standard network API). You will find most of the related source code in ae.c (event loop) and anet.c (networking).
You can use unix domain sockets to improve the performance of Redis roundtrips when client and server are hosted on the same box. It depends on your workload, but the performance benefit (in term of throughput) of unix domain sockets over TCP sockets is typically around 1.5 (i.e. you can process 50% more operations when using unix domain sockets).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With