amazon-web-servicesgoamazon-elastic-beanstalkamazon-elbweb-architecture

I am running a REST API server and I'm not too sure about the infrastructure. Also what can I do to benchmark and improve speed?


My infrastructure is: gandi domain, aws dns, route53 api.domain cname pointing to a to self-signed ssl-enabled elb (having 1 elasticbeanstalk instance). Elasticbeanstalk instance is docker-based. That means nginx forwards to docker instance. Docker instance has nginx which serves static files, and reverse-proxies to golang (fastcgi to port 3000). Data is stored on Amazon RDS and is accessed using go-sql-driver.

It looks overly complicated, what is the best way to simplify?


Solution

  • The answer to your header question "How do I benchmark (tried ping, traceroute, pingdom) and improve speed?" is probably best answered by searching for "website benchmarking" or similar. There are many website benchmarking tools out there. (have a look at Siege, ab, boom, boom in Go, or vegeta. There are many more out there, but that should get you started.)

    The answer to "It looks overly complicated, what is the best way to simplify?" is:

    What do you need it to do?

    For a simple, static site, your setup is overly complex. For a distributed, fault redundant, high-availability site, it's nowhere near enough. You need to fit your infrastructure to your needs.

    "route53 api.domain cname pointing to a to self-signed ssl-enabled elb (having 1 elasticbeanstalk instance):" Do you need the load balancer? Are you going to add more endpoints? Does the application support load balancing in this way? (will requests be treated atomically, are all requests unique etc.)

    "nginx forwards to docker instance:" Do you want to manage the SSL certificate in the Go app, or the NginX config? The way you're running it now is probably the simplest for now, but once again, it depends on your needs.

    "Docker instance has nginx which serves static files, and reverse-proxies to golang (fastcgi to port 3000):" This sounds overly complex (but, it depends on what you want). Can this replaced with nginx just serving a directory of static files on that path? Do you need fastCGI at all here?

    " Data is stored on Amazon RDS and is accessed using go-sql-driver:" This is fine for AWS, once again, depending on your requirements (performance, compliance etc.)

    Hope that helps.