Skip to content

Instantly share code, notes, and snippets.

@StevenACoffman
Last active March 9, 2024 08:11
Show Gist options
  • Save StevenACoffman/de394d6511a387ada9ab988e33be8583 to your computer and use it in GitHub Desktop.
Save StevenACoffman/de394d6511a387ada9ab988e33be8583 to your computer and use it in GitHub Desktop.
Eureka vs Consul

Comparison of Spring Cloud with Eureka

I feel Consul.io does better in the following area:

  • The focus on scriptable configuration allows for better container management.
    Eureka requires either external Configuration Server or multiple configuration files.

  • The options for securing communications is more advanced.
    Eureka requires creating application with security settings desired. Default will allow HTTP only. Registration of end points assumes http but can be forced to https with code.

  • Support for non-REST endpoints via DNS. This would allow database and other resource connections.
    Eureka presumably would do this through ZUUL and/or Sidecar.

Consul vs Eureka

Eureka:

  • AP (weak consistency), state is replicated with “best effort”
  • Services are registered with one server, which attempts to replicate to other servers
  • Service registrations have a TTL, and clients must heartbeat
  • Reads are routed to any server, can be stale or missing data
  • Scales well due to low coordination, especially when server failures relatively rare
  • Fails if all servers down

Consul

  • CP (strong consistency), state is replicated using Raft
  • Services registered with any server, but written via Raft to a quorum
  • Registrations have complex health checks, including gossip failure detection instead of heartbeating
  • Reads routed to any server, consistent by default but stale reads can be requested
  • Stale reads scale well, Consistent reads scale to tens of thousands per second
  • Consistency offers locking and cluster coordination
  • Lots more features (health checking, locking, KV, federation, ACLs)
  • Fails if a majority of servers down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment