Académique Documents
Professionnel Documents
Culture Documents
3rdPartyRegistration
Microservicearchitecture(/index.html)
Thepatterns
Monolithicarchitecture
(/patterns/monolithic.html)
Microservicesarchitecture
(/patterns/microservices.html)
APIgateway(/patterns/apigateway.html)
Clientsidediscovery(/patterns/clientside
discovery.html)
Serversidediscovery(/patterns/serverside
discovery.html)
Serviceregistry(/patterns/service
registry.html)
Selfregistration(/patterns/self
registration.html)
3rdpartyregistration(/patterns/3rdparty
registration.html)
Pattern:3rdPartyRegistration
Context
YouhaveappliedeithertheClientsideServiceDiscoverypattern(clientsidediscovery.html)ortheServersideServiceDiscoverypattern(serverside
discovery.html).Serviceinstancesmustberegisteredwiththeserviceregistry(serviceregistry.html)onstartupsothattheycanbediscoveredandunregisteredon
shutdown.
Problem
Howareserviceinstancesregisteredwithandunregisteredfromtheserviceregistry?
Forces
Jointhemicroservicesgooglegroup
(https://groups.google.com/forum/#!forum/microservices)
Serviceinstancesmustberegisteredwiththeserviceregistryonstartupandunregisteredonshutdown
Serviceinstancesthatcrashmustbeunregisteredfromtheserviceregistry
Serviceinstancesthatarerunningbutincapableofhandlingrequestsmustbeunregisteredfromtheserviceregistry
Solution
Gotaquestion?Contactme
(https://chrisrichardson.wufoo.com/forms/zgp4xr60erb04x/)
A3rdpartyregistrarisresponsibleforregisteringandunregisteringaserviceinstancewiththeserviceregistry.Whentheserviceinstancestartsup,theregistrar
registerstheserviceinstancewiththeserviceregistry.Whentheserviceinstanceshutsdowns,theregistrarunregisterstheserviceinstancefromtheservice
registry.
Examples
Examplesofthe3rdPartyRegistrationpatterninclude:
NetflixPrana(https://github.com/Netflix/Prana)a"sidecar"applicationthatrunsalongsideanonJVMapplicationandregisterstheapplicationwithEureka.
AWSAutoscalingGroups(http://aws.amazon.com/autoscaling/)automatically(un)registersEC2instanceswithElasticLoadBalancer
Registrator(https://github.com/gliderlabs/registrator)registersandunregistersDockercontainerswithvariousserviceregistries
ClusteringframeworkssuchasKubernetes(https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/services.md)andMarathon
(https://mesosphere.github.io/marathon/docs/servicediscoveryloadbalancing.html)(un)registerserviceinstanceswiththebuiltin/implicitregistry
Resultingcontext
Thebenefitsofthe3rdPartyRegistrationpatterninclude:
TheservicecodeislesscomplexthanwhenusingtheSelfRegistrationpattern(selfregistration.html)sinceitsnotresponsibleforregisteringitself
Theregistrarcanperformhealthchecksonaserviceinstanceandregister/unregistertheinstancebasedthehealthcheck
Therearealsosomedrawbacks:
The3rdpartyregistrarmightonlyhavesuperficialknowledgeofthestateoftheserviceinstance,e.g.RUNNINGorNOTRUNNINGandsomightnotknow
whetheritcanhandlerequests.However,asmentionedabovesomeregistrarssuchasNetflixPranaperformahealthcheckinordertodeterminethe
availabilityoftheserviceinstance.
http://microservices.io/patterns/3rdpartyregistration.html
1/2
3/3/2015
3rdPartyRegistration
Unlesstheregistrarispartoftheinfrastructureit'sanothercomponentthatmustbeinstalled,configuredandmaintained.Also,sinceit'sacriticalsystem
componentitneedstobehighlyavailable.
Relatedpatterns
ServiceRegistry(serviceregistry.html)
ClientSideDiscovery(clientsidediscovery.html)
ServerSideDiscovery(serversidediscovery.html)
SelfRegistration(selfregistration.html)isanalternativesolution
Tweet
http://microservices.io/patterns/3rdpartyregistration.html
Follow@MicroSvcArch
Copyright2014ChrisRichardsonAllrightsreserved.
2/2