4 Architecting IoT Cloud
225
XML), or binary (Avro) message formats to choose from. Any number of consumers
can receive channel messages and any number of producers can send messages.
4.7.1.3 Service Discovery
In Cloud-based applications consisting of several microservices, discovering the
location of each microservice is a challenging task. Although infrastructure services
(e.g., message brokers) often have a fixed static location/address identified through
operating system (OS) environment variables, finding a service location can be
difficult because application services use dynamically assigned locations/addresses.
In addition, service instances change due to upgrades and auto-scaling. Therefore,
a service discovery component is needed to locate each service. Service discovery
can be driven either by the client or by the server [30]:
• Client-Side Discovery – The client governs network locations for service
instances by querying a service registry containing available service instances;
when a service instance starts, its network location is documented with the
service registry and then removed when the instance ends. The instance registry
is updated periodically with a heartbeat technique. Next, a client selects an
available service instance and makes a request via a load-balancing algorithm.
• Server-Side Discovery – Client uses a load balancer to make a service request. In
this approach, the balancer looks up the service registry and then sends a request
to a free service instance. In the same manner as client-side discovery, in this
approach, instances should also be registered in the service registry.
4.7.1.4 Service Registry
Service registries are a kind of databases that are able to keep track of service
instance and network location information. Since service registry is an integral
component of service discovery, it must be kept up to date and must be highly
available. An example of a good service registry is Netflix Eureka. It includes a
REST API used to query and register service instances. Another registry framework
example would be Apache Zookeeper, originally a Hadoop sub-project that is now
a separate top-tier project [30].
4.7.1.5 Deployment Strategy
Creating a monolithic application requires using one or many identical copies of
one, large application. Generally, you need to prepare N servers (can be virtual
or physical) and run M application instances on each of them. While deploying a
monolithic application is not always an easy task, it is a less complicated process
than that of a microservice application deployment, which is based on hundreds of
225
XML), or binary (Avro) message formats to choose from. Any number of consumers
can receive channel messages and any number of producers can send messages.
4.7.1.3 Service Discovery
In Cloud-based applications consisting of several microservices, discovering the
location of each microservice is a challenging task. Although infrastructure services
(e.g., message brokers) often have a fixed static location/address identified through
operating system (OS) environment variables, finding a service location can be
difficult because application services use dynamically assigned locations/addresses.
In addition, service instances change due to upgrades and auto-scaling. Therefore,
a service discovery component is needed to locate each service. Service discovery
can be driven either by the client or by the server [30]:
• Client-Side Discovery – The client governs network locations for service
instances by querying a service registry containing available service instances;
when a service instance starts, its network location is documented with the
service registry and then removed when the instance ends. The instance registry
is updated periodically with a heartbeat technique. Next, a client selects an
available service instance and makes a request via a load-balancing algorithm.
• Server-Side Discovery – Client uses a load balancer to make a service request. In
this approach, the balancer looks up the service registry and then sends a request
to a free service instance. In the same manner as client-side discovery, in this
approach, instances should also be registered in the service registry.
4.7.1.4 Service Registry
Service registries are a kind of databases that are able to keep track of service
instance and network location information. Since service registry is an integral
component of service discovery, it must be kept up to date and must be highly
available. An example of a good service registry is Netflix Eureka. It includes a
REST API used to query and register service instances. Another registry framework
example would be Apache Zookeeper, originally a Hadoop sub-project that is now
a separate top-tier project [30].
4.7.1.5 Deployment Strategy
Creating a monolithic application requires using one or many identical copies of
one, large application. Generally, you need to prepare N servers (can be virtual
or physical) and run M application instances on each of them. While deploying a
monolithic application is not always an easy task, it is a less complicated process
than that of a microservice application deployment, which is based on hundreds of
