What is eureka?
Eureka is a REST‑based service registry created by Netflix. It lets microservices automatically register themselves at startup and lets other services discover them at runtime, so you don’t have to hard‑code network locations. In the Spring Cloud ecosystem it’s known as “Netflix Eureka”.
Let's break it down
- Eureka Server - a central registry where services announce their existence.
- Eureka Client - any application (service or consumer) that talks to the server to register itself or to look up other services.
- Registration - when a service starts, it sends its name, host, port, and health‑check URL to the server.
- Heartbeat - the client periodically pings the server to say “I’m still alive”. If the server stops hearing from a client, it removes it.
- Service Discovery - a client asks the server for all instances of a given service name and receives a list of URLs it can call.
- Self‑preservation mode - if the server detects a network glitch, it temporarily stops expiring instances to avoid mass deregistration.
Why does it matter?
In a microservice world services are created, scaled, and destroyed dynamically. Without a registry you would need to manually update configuration files or DNS every time something changes. Eureka provides:
- Automatic, real‑time awareness of where services live.
- Load‑balancing support by giving callers a list of healthy instances.
- Faster recovery from failures because dead instances are removed automatically.
- Simpler code - services just ask “where is X?” instead of storing static URLs.
Where is it used?
- Applications built with Spring Cloud Netflix often use Eureka as the default discovery mechanism.
- Many companies that adopted Netflix’s OSS stack (e.g., e‑commerce, streaming, IoT platforms) run Eureka clusters.
- It can be combined with client‑side load balancers like Ribbon or Spring Cloud LoadBalancer.
- Though less common in Kubernetes (which has its own DNS‑based discovery), some teams still run Eureka alongside K8s for legacy reasons.
Good things about it
- Easy to set up - a few Spring Boot starters get a server and client running in minutes.
- Tight Spring integration - automatic configuration, health checks, and load‑balancing support.
- Self‑preservation helps avoid cascading failures during network glitches.
- Lightweight - the server stores only minimal metadata, so it scales well for many services.
- Open source - free to use and modify, with a large community of examples.
Not-so-good things
- Single point of failure if you run only one Eureka server; you need to run a cluster for high availability.
- Eventual consistency - there can be a short delay before new instances appear to all clients.
- Limited to the Java/Spring ecosystem; non‑Java services need extra libraries or custom code.
- Feature set is narrower than alternatives like Consul, etcd, or Zookeeper (e.g., no key‑value store, fewer health‑check options).
- Self‑preservation can mask real problems if not tuned, causing stale instances to linger longer than desired.