[QUESTION] Shared Connection pool for redis between services
Purushoth24051999 opened this issue · 4 comments
Hi,
I have tried to create a common connection Pool for multiple services by passing Redis class object through shared memory (IPC). But I cannot use this shared Redis object in other services except in service where connections are created. It throws "Reading Access Violation" error
Is it possible to create a Common Redis connection pool between services
Note: All these services are running in single machine
I'm not familiar with shared memory. However, after some searching, I found this link says that class with virtual pointer cannot work with shared memory.
Redis class has 2 shared_ptr data members, which might have virtual pointer, e.g. it's a derived class.
In a word, you cannot use Redis class with shared memory.
By the way, why not use different Redis object for different processes?
I'm not familiar with shared memory. However, after some searching, I found this link says that class with virtual pointer cannot work with shared memory.
Redis class has 2 shared_ptr data members, which might have virtual pointer, e.g. it's a derived class.
In a word, you cannot use Redis class with shared memory.
By the way, why not use different Redis object for different processes?
In my case I'm supposed to create as many process user requests. Since redis has maximum connection limit which has a default value 10000, creating seperate connection for each process might exceed the limit and becomes a costly process for my application
Since several modules in my project share common redis server I not supposed to alter max connection limit of redis. That's why I tried using it
I have achieved my requirement through creating a connection pool in parent service and child processes will request parent to perform redis operations through uv_tcp_t from libuv library
I'm supposed to create as many process user requests
This is not a good idea. You'd better reuse the connection.
Since you've solved the problem, I'll close this issue. If you still have problem with it, feel free to reopen it.
Regards