
FinTech - Global latency sensitive service on EKS
Background of the service
- A global latency sensitive service is running on AWS across multiple regions.
- Some components are stateful. We make sure the stateful components have a backup node which can take over the workload when there is a failure .
- Some components have long-lived TCP connection. We need to gracefully close the connection before we do release.
- To reduce the latency as much as possible, we deploy our services in six regions.
Architecture for a latency sensitive service.
Route 53 Traffic Policy
Traffic policy provides geo-based DNS resolution. This can be useful to route traffic between different cloud providers.
Global Accelerator
[Endpoint group] provides a entrypoint for your service in specific AWS region. You can route traffic between different AWS regions.
Data Layer
In general use case, we can put the database in the same region with the service to have the lowest latency. But, this results you need to have a application to aggregate the data from many databases in order to present the aggregated data for users.
How do we deploy services in EKS?
- Used StatefulSet for stateful components. Also, some components have a MySQL sidecar container, it needs
volumeClaimTemplates
to help it persist the data. - Used EKS to serve components with large disk volume. We need to use AWS Backup service to make sure the data in the EBS volume has a daily snapshot.
- Used EKS with EFS to share disk between specific services. For example, a service A will parse the logs generated by service B. In this case, we use EFS to share logs file between service A and service B.
apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
name: example-app
namespace: app
annotations:
fluxcd.io/automated: "true"
spec:
releaseName: example-app
chart:
git: ssh://git@github.com/my-org/helm-charts
ref: app_1.0.0
path: charts/app
values:
image:
repository: xxxxxxxxxxx.dkr.ecr.ap-northeast-1.amazonaws.com/app
tag: "xxxxxxxxxxxxxxxxxxxxxx"
targetgroupbinding:
... truncated ...
serviceAccount:
enabled: true
irsaRoleArn: "arn:aws:iam::xxxxxxxxxxxxx:role/app_irsa_role"
configuration:
environment: "prod" <- use variables to retrieve specific configs
region: "frankfurt"
This is an example for deploying an service in EKS across many regions.
The helm chart covers all the details and let you easily scale your service.