raunak-r / tech-notes

A repository to store code snippets, general functions, and any other notes taken for various technologies and tools. See ISSUES Tab for in-depth studies.
2 stars 0 forks source link

Microservices Architecture #25

Open raunak-r opened 1 year ago

raunak-r commented 1 year ago

Intro to Gateways

raunak-r commented 1 year ago

Python with Eureka

Refer stacklink Need to have REST implementation that follows Eureka-REST-operations . Below is a sample implementation that follow Eureka REST in Python.

Refer to full documentation at Python client for Netflix Eureka

from eureka.client import EurekaClient
import logging

logging.basicConfig()

ec = EurekaClient("MyApplication",
                  eureka_domain_name="test.yourdomain.net",
                  region="eu-west-1",
                  vip_address="http://app.yourdomain.net/",
                  port=80,
                  secure_vip_address="https://app.yourdomain.net/",
                  secure_port=443
)
print ec.get_zones_from_dns()
print ec.get_eureka_urls()
print ec.register()
print ec.update_status("UP")  # Or ec.register("UP")
print ec.heartbeat()
raunak-r commented 1 year ago

Load Balancers

Mid tier LB's - https://stackoverflow.com/a/57835756 - A mid-tier load balancer is a load balancer that isn't exposed to the Internet, but instead is intended to distribute internally-generated traffic between components in your stack.

An example would be the "order placement" (micro)service verifying prices by sending requests to the "catalog item details" (micro)service -- you need a mid-tier load balancer in front of the multiple nodes providing the "catalog item details" service so that the request is routed to a healthy endpoint for that service, without "order placement" needing to be responsible for somehow finding a healthy "catalog item details" endpoint on its own.