Does Consul client agent cache the status of services ?

1,000 views
Skip to first unread message

wolfgang

unread,
Mar 24, 2016, 9:52:44 PM3/24/16
to Consul
Hi there,

Does Consul client agent cache the status of services in the cluster so that when I query the status of services 
to a client agent, it returns the answer from its cache in it ? or the agent always escalates the query to one of Consul server agents ?

I'm thinking of which way is better I should cache the status of services from consul's callback in my logic by myself or query to a Consul client agent when needed.
( If I take the latter one and client agents always escalate queries to a server agent, I'm afraid of network latency will be quite high 
because a client agent and a server agent are not on the same machine. )

Cheers,
Wolfgang

James Phillips

unread,
Mar 25, 2016, 2:48:17 AM3/25/16
to consu...@googlegroups.com
Hi Wolfgang,

Most queries (except for the /v1/agent API) are forwarded up to the Consul servers, and the agents don't really do any caching. There's a persistent single TCP connection that all the requests are multiplexed through, and if you set the consistency mode of your query to one of the more relaxed modes then any server (not just the leader) can answer it, which helps with scaling. Any caching would need to be in your application. The Consul servers are designed for high read throughput, and if you are within a given cluster hopefully your network is fast, so it's best to benchmark things in your environment to see how necessary caching is.

-- James

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
IRC: #consul on Freenode
---
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/consul-tool/1a4dc238-9149-4cd7-a25b-e15f3ced1fdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages