高性能的REST API - 哪些语言/堆栈? [英] High-performance REST API - Which language/stack?

查看:157
本文介绍了高性能的REST API - 哪些语言/堆栈?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发使用Ruby on Rails的网站。我想开发的REST API(JSON)分别以最大限度地提高性能,Rails堆栈只是带走了太多了。

I am developing a site using Ruby on Rails. I would like to develop the REST API (JSON) separately to maximize performance, the Rails stack just takes away too much.

是否有任何性能基准测试在那里?你认为会产生最好的性能?我目前思考以下,因为这是我有经验。还有什么我应该考虑?它应该是轻便的。

Are there any performance benchmarks out there? What do you think would yield the best performance? I am currently thinking about the following, because that's what I have experience with. Is there anything else I should consider? It should be lightweight.


  • 的node.js

  • 斯卡拉喷雾(http://spray.io/)

  • 红宝石西纳特拉

谢谢!

推荐答案

摘要:最大化你的表现作为一个开发者。使用堆叠你知道最好的。首先使它工作,,然后使其快。

Summary: Maximize your performance as a developer. Use stack you know best. First make it work, then make it fast.

是否有任何性能基准了吗?

Are there any performance benchmarks out there?

有各种基准那里。比方说,Node.js的可以处理100K HPS(每秒helloworlds)和西纳特拉唯一能做的80K。这是什么告诉你吗?什么也没有。

There are all kinds of benchmarks out there. Let's say, node.js can handle 100k HPS (helloworlds per second) and Sinatra can only do 80k. What does it tell you? Nothing.

此外,有时更高的性能是有很大的成本。以红宝石C扩展,例如。当然,C的运行速度比红宝石快,但它prevents从其它内核上运行(因为GIL)的其他线程。

Also, sometimes higher performance comes at a great cost. Take ruby C extensions, for example. Sure, C runs faster than Ruby, but it prevents other threads from running on other cores (because of GIL).

所以,不要只从互联网基准数字选择技术。有这么多的因素除了原料HPS数量来考虑。

So, don't choose tech only by benchmark figures from the internet. There are so many factors to consider besides raw HPS number.

LINK :如果你认为Rails是太重了,你应该尝试轨-API 。它基本上是Rails的一个精简版(你不需要在API服务器之类的Cookie身份验证或MSIE呈现佣工)。

LINK: If you think Rails is too heavy, you should try rails-api. It's basically a stripped down version of Rails (you don't need things like cookie authentication or MSIE rendering helpers in an api server).

我运行,处理一些负载的API服务器。第一个版本是用Rails编写。然后我想:嘿,Rails是一个臃肿的(C),让我们重写一切与西纳特拉。然后,我不得不无奈陆续到来波。原来,Rails的做了很多,我没有AP preciate小,但有用的东西。我放弃了,用Rails再次重写了它(应用经验教训),并幸福地生活至今。

I run an API server that handles some load. First version was written with Rails. Then I thought "Hey, Rails Is Bloated (c), let's rewrite everything with Sinatra". And then I had waves of frustration coming one after another. It turned out that Rails does a lot of small but helpful things which I didn't appreciate. I gave up, rewrote it with Rails again (applying lessons learned) and lived happily ever since.

这篇关于高性能的REST API - 哪些语言/堆栈?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆