JActor介绍
原题目:Introducing JActor
Vertical scaling is today a major issue when writing server code. Threads and locks are the traditional approach to making full utilization of fat (multi-core) computers, but result is code that is difficult to maintain and which to often does not run much faster than single-threaded code.
当编写服务端代码时候,垂直扩展仍然是一个重大的问题。线程和锁是充分利用大计算机(多核)的传统方式,但结果却是代码很难维护,并且经常并不比单线程代码快多少。
Actors make good use of fat computers but tend to be slow as messages are passed between threads. Attempts to optimize actor-based programs results in actors with multiple concerns (loss of modularity) and lots of spaghetti code.
Actor模式能很好的使用大计算机,但当消息从线程间传递时比较慢。优化基于actor的设计,结果往往是多重关系的actor(失去了模块化)和一大堆面条一样的代码。
The approach used by JActor is to minimize the messages passed between threads by executing the messages sent to idle actors on the same thread used by the actor which sent the message. Message buffering is used when messages must be sent between threads, and two-way messaging is used for implicit flow control. The result is an approach that is easy to maintain and which, with a bit of care to the architecture, provides extremely high rates of throughput.
JActor使用的方式是,最小化线程间传递的消息。在执行消息传递时候使用和消息发送actor同一个线程的空闲actor。 消息缓存用于消息必须在线程间传递时候,双向消息传递用于隐式流程控制。最终结果就是,只要注意一点架构,这是一个搭建容易维护的,非常高的速率的吞吐量系统的好方式。
On an intel i7, 250 million messages can be passed between actors in the same JVM per second–several orders of magnitude faster than comparable actor frameworks.
在intel i7 在一个jvm虚拟机中每秒可传递2.亿条消息,要比同类actor框架快一个数量级。
A fully durable in-memory database was also developed as a proof of concept, which processes transactions at a rate of 1 million per second when using an SSD for the backing store. Again, this is orders of magnitude greater than comparable approaches.
在使用SSD作为后台存储的,全内存数据库的原型系统中,它达到了每秒1百万个事务。再次超越了同类实现。
All code is LGPL, so there are effectively no constraints on usage.
所有的代码都是基于LGPL授权,因此在使用上是高效的没有什么限制。
GitHub: https://github.com/laforge49/JActor
转载于:https://blog.51cto.com/xpbear/1143325