event-gateway icon indicating copy to clipboard operation
event-gateway copied to clipboard

Guidance how to use event-gateway in production environment

Open brianneisler opened this issue 8 years ago • 9 comments

brianneisler avatar Aug 10 '17 19:08 brianneisler

For now, let's keep the discussion here as we want to recommend the best solutions for our users.

The Event Gateway is a horizontally scalable system. We can handle bigger traffic by adding instances and load balancing traffic between them. The most common approach right now is to put EG instances behind a load balancer in different AZs.

                        ┌───────────────────┐                        
                        │                   │                        
                        │   Load Balancer   │                        
                        │                   │                        
                        └───────────────────┘                        
                                  │                                  
                                  │                                  
          ┌────────────┬──────────┴───────────┬────────────┐         
AZ1 ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─│─ ─ ─ ─ ┐   AZ2 ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─│─ ─ ─ ─ ┐
          ▼            ▼                      ▼            ▼         
│   ┌──────────┐ ┌──────────┐   │   │   ┌──────────┐ ┌──────────┐   │
    │          │ │          │           │          │ │          │    
│   │    EG    │ │    EG    │   │   │   │    EG    │ │    EG    │   │
    │ instance │ │ instance │           │ instance │ │ instance │    
│   │          │ │          │   │   │   │          │ │          │   │
    └──────────┘ └──────────┘           └──────────┘ └──────────┘    
│                               │   │                               │
 ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─     ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ 

Above architecture provides HA and failover. In case of multi-region deployment, we just add LB addresses to DNS record.

Depending on use-case another solution would to not use LB and expose EG as an edge proxy. An obvious benefit is latency as there is no additional network hop for LB. On the other hand, if we want to setup HA/failover system, this means that we require from the user to use more sophisticated failover mechanism (e.g. using keepalived or corosync/peacemaker). It complicates deployment a lot and definitely doesn't feel like "serverless" experience. Of course, I'm not saying it's not possible, it is, but IMHO it shouldn't be the recommended way. In most cases, additional network hop is not an issue.

There is a question if deploying EG with the first approach blocks us from adding any features to the EG. Right now I don't see that risk.

mthenw avatar Aug 17 '17 10:08 mthenw

This is great, thank you.

damianesteban avatar Aug 24 '17 23:08 damianesteban

So in AWS terms, instances of EG would need to be run in containers on ECS or on EC2 instances then with an ELB sitting in front? This unfortunately sounds like it could add significant cost and complexity that moves away from a truly serverless deployment. Am I misunderstanding?

msheldonfl avatar Aug 25 '17 19:08 msheldonfl

@msheldonfl You understood it properly. event-gateway is infrastructure piece intended to run on real/virtual servers. We have plans for a hosted version for users that want to be 100% serverless.

mthenw avatar Aug 28 '17 10:08 mthenw

Thanks I'd be interested in a hosted version.

msheldonfl avatar Aug 28 '17 11:08 msheldonfl

So... anyone deploying this to kubernetes? I can see a couple different deployment strategies, but I'm wondering if someone's already gotten an informed opinion.

StevenACoffman avatar Sep 11 '17 21:09 StevenACoffman

@StevenACoffman thanks for your question. We will provide guidelines for deploying on different platforms (Kubernetes, AWS EC2, AWS ECS etc) in upcoming weeks.

mthenw avatar Sep 18 '17 12:09 mthenw

Providing a docker image would be most useful so it can be spun up on ECS. A hosted SaaS may be useful, but I am a little concerned about the possible latency - it would effectively add a second http request into the mix. One to the EG, then a second to the actual function.

curiouslittledroid avatar Sep 19 '17 01:09 curiouslittledroid

@pcaithness that would be most excellent, I agree.

damianesteban avatar Sep 19 '17 17:09 damianesteban