I’m trying to run multiple requests against redisgraph but I notice a large drop off in requests after 4 concurrent requests.
When they’re sequential, they take around 80ms but as I add more parallelism they take longer and longer (4 becomes 120ms, 6 180ms, 12 becomes 250ms).
I’ve tried setting THREAD_COUNT to be higher but this has not been successful. I am running on a 28 core machine with a lot of memory.
GRAPH.PROFILE, it looks like the steps in the execution are taking longer and longer.
Any chance these request modify the graph?
They do not. They are read-only and quite complex though.
Would you mind sharing them ?
I don’t have them right now but I can try and make a reproducer.
Do you have any general tips though for me to try and debug what’s going on or to improve the concurrency?
Sure use GRAPH.EXPLAIN and GRAPH.PROFILE to inspect the execution-plan used to run the query and the amount of data processed, make sure indices are utilized.
I believe that our requests are being queued.
Is RedisGraph limited by the single-threaded access nature of Redis?
If so, is there a way for us to make a read-only replica that is not limited by single-threaded data access?
If not, it sounds like we should make some replicas.
RedisGraph has an internal threadpool, the concurrency model is multiple read single write. so yes, multiple read queries are executed in parallel.
Can RedisGraph execute multiple queries on multiple processors?
It is clear to me that RedisGraph can serve multiple requests at once, but reading over the white paper again suggests that RedisGraph might only be able to run on 1 processor. (i.e. can RedisGraph execute 4 queries, each on 1 processor, thus utilizing 4 cores)
Or to be able to process multiple requests using multiple processors, I should use a cluster? (Then we can get 1 core for each replica)
RedisGraph can execute queries on multiple processors simultaneously. The threadpool mentioned by above is by default sized to the system’s core count, and queries will be dispatched to different processors
using whatever strategem POSIX threads utilize.
However, this is only true for read queries at this time. Only one write query may be running at any given time.
If I have a complex query, will there be parts of it that run on the redis main thread? I understand that matrix multiplication can happen on different processors (through GraphBLAS).
Like when I have a
(MATCH a:A) RETURN a.property and RedisGraph needs to get the matrix for nodes of type A (and I assume some structure that will get the property). Will these happen in sequence or can data access like this be spread across multiple processors?