英文:
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?
问题
我的基础架构是:gandi域名,aws dns,route53 api.domain cname指向一个启用了自签名SSL的ELB(具有1个Elastic Beanstalk实例)。Elastic Beanstalk实例基于Docker。这意味着nginx将流量转发到Docker实例。Docker实例中有一个nginx服务器用于提供静态文件,并且反向代理到golang(通过FastCGI到端口3000)。数据存储在Amazon RDS上,并使用go-sql-driver进行访问。
看起来过于复杂了,简化的最佳方法是什么?
英文:
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?
答案1
得分: 2
你的标题问题“如何进行基准测试(尝试了ping、traceroute、pingdom)并提高速度?”的答案可能最好通过搜索“网站基准测试”或类似的关键词来回答。有很多网站基准测试工具可供选择(可以查看Siege、ab、boom、Go中的boom或vegeta等工具)。还有很多其他工具可供选择,但这些应该能帮助你入门。
对于“看起来过于复杂,简化的最佳方法是什么?”的回答是:
你需要它做什么?
对于一个简单的静态网站来说,你的设置过于复杂。对于一个分布式、容错、高可用性的网站来说,这远远不够。你需要根据自己的需求来调整基础架构。
对于“route53 api.domain cname指向自签名的启用ssl的elb(具有1个elasticbeanstalk实例):”,你需要负载均衡器吗?你是否打算添加更多的端点?应用程序是否支持这种负载均衡方式?(请求是否被视为原子操作,所有请求是否都是唯一的等等)
对于“nginx转发到docker实例:”,你想在Go应用程序中管理SSL证书还是在NginX配置中管理?目前你的运行方式可能是最简单的,但再次强调,这取决于你的需求。
对于“Docker实例具有提供静态文件的nginx,并反向代理到golang(通过fastcgi到端口3000):”,这听起来过于复杂(但这取决于你的需求)。是否可以用nginx直接提供该路径下的静态文件目录?在这里,你是否需要fastCGI?
对于“数据存储在Amazon RDS上,并使用go-sql-driver进行访问:”,在AWS上这是可以的,再次取决于你的需求(性能、合规性等)。
希望对你有所帮助。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论