TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Polyglot is a distributed web framework for multiple programming languages

135 点作者 sausheong将近 11 年前

18 条评论

Xorlev将近 11 年前
&quot;Messsage queue - a queue that receives the messages that represent the HTTP request. the acceptor accepts HTTP requests and converts the requests into messages that goes into the message queue. The messages then gets picked up by the next component, the responder. The implementation of the message queue is a RabbitMQ server.&quot;<p>Alrighty then. Someone has never scaled RabbitMQ vs. a basic HTTP service. If raw scalability is what you&#x27;re looking for w&#x2F; a polyglot backend, an edge service that accepts HTTP and turns those requests into Thrift structs (or similar) to RPC to various polyglot services might be better for you. This is the model most use.<p>However, I&#x27;m unsure how this&#x27;ll be more &#x27;performant&#x27; than picking the right technology from the start and architecting wisely. Generally, the more performant you want something to be the simpler you build it and only compromise where necessary. Thrift&#x2F;RabbitMQ are definitely complexity compromises.<p>Complexity is the bane of scalability.<p>Additionally, if you needed pure scalability, you generally have purpose-built services for each &quot;responder&quot; which is load balanced over. Pretty similar to this, minus the message queue.<p>I imagine having a message queue in the middle of your HTTP response path could lead to some nasty latency spikes too. Much better to drop a request with a 503 than have the next N spin for minutes while workers chug through it. Especially if you&#x27;re taking in 10K req&#x2F;s.<p>Last thought: The benchmarks are lacking detail, could use a more thorough job.
评论 #8033701 未加载
kcorbitt将近 11 年前
Switching from a monolithic framework like Rails to a number of independent communicating services that handle different responsibilities is a classic step in scaling. However, to the best of my knowledge that transition usually involves moving to a mostly-custom setup dependent on the app&#x27;s specific needs.<p>It&#x27;s not clear exactly what functionality Polyglot provides beyond, say, raw RabbitMQ, but if it can find a way to encode best practices in a service-oriented architecture it could be a handy tool for developers going through this process for the first time.
评论 #8035095 未加载
buro9将近 11 年前
I had to stop and check where this guy works. 2 companies I know of have just moved to something fairly similar.<p>A request is turned into a JSON message pumped into a queue with a signature declaring the type of message it contains, service discovery reads from the queue and allocates a service to handle it, shuffling it onto another queue (and if necessary spinning up the service). The service picks up the queued item, processes it and hands it back where the new message may be the response (in which case it gets handed back) or another service call (in which case discover the handler and assign it to a queue).<p>It&#x27;s SOA based on messaging and a basic pipeline. Except they don&#x27;t call it that.<p>Thankfully the applications in question do not have low response time as a core criteria.
seguer将近 11 年前
If the goal is the ability to have certain routes processable by different languages&#x2F;systems you could achieve this with reverse proxying (from eg. nginx) [1].<p>That way you can leverage any existing language frameworks and run them as standard HTTP responders. No need to work with a queue (and add it to the stack).<p>You can still limit the HTTP methods each proxy responds to as well [2].<p>[1]: <a href="http://nginx.com/resources/admin-guide/reverse-proxy/" rel="nofollow">http:&#x2F;&#x2F;nginx.com&#x2F;resources&#x2F;admin-guide&#x2F;reverse-proxy&#x2F;</a><p>[2]: <a href="http://stackoverflow.com/questions/8591600/nginx-proxy-pass-based-on-whether-request-method-is-post-put-or-delete" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;8591600&#x2F;nginx-proxy-pass-...</a>
评论 #8034106 未加载
评论 #8034004 未加载
floatboth将近 11 年前
So, it&#x27;s like mongrel2, but a bit worse: AMQP is centralized, unlike ZeroMQ.
评论 #8031741 未加载
评论 #8031782 未加载
评论 #8031618 未加载
dbpokorny将近 11 年前
&quot;forcing the deliberate use of different programming languages&quot;<p>...wait, what? I don&#x27;t see how this solves anything. It&#x27;s like asking American schoolchildren to learn English, Russian, and Chinese before doing math. Makes no sense.
评论 #8031939 未加载
SEJeff将近 11 年前
Also relevant to building microservices in a somewhat similar fashion: <a href="https://github.com/koding/kite" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;koding&#x2F;kite</a>
datashaman将近 11 年前
This sounds very similar to tir &#x2F; mongrel2.
shebson将近 11 年前
This is cool, but the naming is unfortunate as Polyglot is already a somewhat popular library for doing internationalization in Javascript: <a href="https://github.com/airbnb/polyglot.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;airbnb&#x2F;polyglot.js</a>
ilaksh将近 11 年前
Seems like this is pretty much what every single system does that is based on a web application that scales with a message queue.<p>With Polyglot are there standard SDKs for responders or acceptors?<p>I think we should relate this to that ocaml mirageos thing and the idea of a common knowledge representation for program generation. I think pattern with queue has a fairly close correspondence with some common OOP patterns.<p>We are repeating the same patterns over and over in different contexts for different applications. I think that we have semantic representations and programming languages that if we created a good common dictionary and referenced that rather than restating everything I different forms then we could get much better code reuse.
mcguire将近 11 年前
&quot;<i>1. Acceptor</i><p>&quot;<i>2. Message queue</i><p>&quot;<i>3. Responder</i>&quot;<p>So, a SOA?
评论 #8031766 未加载
programminggeek将近 11 年前
I actually built something very similar 2 years ago <a href="http://radial.retromocha.com" rel="nofollow">http:&#x2F;&#x2F;radial.retromocha.com</a><p>Mine used a node proxy instead of a message queue, but same basic idea. It makes scaling and changing languages so much easier.<p>Really, the trick is having a standard message protocol that everything abides by. Once you have that, building a proxy and frameworks around it is pretty trivial. I chose something similar to JSON-RPC and for what I wanted&#x2F;needed it worked well.<p>It never saw any kind of scale, but it was a fun project.
评论 #8033667 未加载
评论 #8034034 未加载
jgill将近 11 年前
I thought of Polyglot by AirBnB when I first saw this post, <a href="https://github.com/airbnb/polyglot.js" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;airbnb&#x2F;polyglot.js</a>
webmaven将近 11 年前
Acceptors &#x2F; Responders feel a bit like Python&#x27;s WSGI model, with the addition of a queue in the middle for connecting gateways to applications. I suspect that the similarity extends to JSGI (Javascript), SCGI, and PCGI (perl).
EGreg将近 11 年前
What is the benefit of having this vs say a monolithic framework?
评论 #8031772 未加载
GUNHED_158将近 11 年前
I was thinking why RabbitMQ and not ZeroMQ? just for my knowledge
评论 #8032697 未加载
评论 #8035086 未加载
mmgutz将近 11 年前
vert.x?
评论 #8031552 未加载
CmonDev将近 11 年前
Based on examples, it seems to be meant for dynamic scripting languages, rather than programming languages?
评论 #8035297 未加载