作者归档

Disruptor 2.0 – All Change Please

原文地址:http://mechanitis.blogspot.com/2011/08/disruptor-20-all-change-please.html  (因被墙移到墙内)  作者:Trisha

Martin recently announced version 2.0 of the Disruptor – basically there have been so many changes since we first open-sourced it that it’s time to mark that officially.  His post goes over all the changes, the aim of this article is to attempt to translate my previous blog posts into new-world-speak, since it’s going to take a long time to re-write each of them all over again. Now I see the disadvantage of hand-drawing everything.

阅读全文

Dissecting the Disruptor: What’s so special about a ring buffer?

原文地址:http://mechanitis.blogspot.com/2011/06/dissecting-disruptor-whats-so-special.html(因被墙移到墙内) 作者:Trisha

Recently we open sourced the LMAX Disruptor, the key to what makes our exchange so fast.  Why did we open source it?  Well, we’ve realised that conventional wisdom around high performance programming is… a bit wrong. We’ve come up with a better, faster way to share data between threads, and it would be selfish not to share it with the world.  Plus it makes us look dead clever.

On the site you can download a technical article explaining what the Disruptor is and why it’s so clever and fast.  I even get a writing credit on it, which is gratifying when all I really did is insert commas and re-phrase sentences I didn’t understand.

However I find the whole thing a bit much to digest all at once, so I’m going to explain it in smaller pieces, as suits my NADD audience.

First up – the ring buffer.  Initially I was under the impression the Disruptor was just the ring buffer.  But I’ve come to realise that while this data structure is at the heart of the pattern, the clever bit about the Disruptor is controlling access to it.
阅读全文

LMAX架构

原文地址:http://martinfowler.com/articles/lmax.html 作者:Martin Fowler

译文地址:http://www.jdon.com/42452 译者:banq

LMAX是一种新型零售金融交易平台,它能够以很低的延迟(latency)产生大量交易(吞吐量). 这个系统是建立在JVM平台上,核心是一个业务逻辑处理器,它能够在一个线程里每秒处理6百万订单. 业务逻辑处理器完全是运行在内存中(in-memory),使用事件源驱动方式(event sourcing). 业务逻辑处理器的核心是Disruptors,这是一个并发组件,能够在无锁的情况下实现网络的Queue并发操作。他们的研究表明,现在的所谓高性能研究方向似乎和现代CPU设计是相左的。

目录

  1. 整体架构
  2. 业务逻辑处理
  3. Disruptors的输入和输出
  4. 队列和机制偏爱的缺乏
  5. 你需要使用这个架构吗

 

过去几年我们不断提供这样声音:免费午餐已经结束。我们不再能期望在单个CPU上获得更快的性能,因此我们需要写使用多核处理的并发软件,不幸的是, 编写并发软件是很难的,锁和信号量是很难理解的和难以测试,这意味着我们要花更多时间在计算机上,而不是我们的领域问题,各种并发模型,如Actors 和软事务STM(Software Transactional Memory), 目的是更加容易使用,但是按下葫芦飘起瓢,还是带来了bugs和复杂性.

我很惊讶听到去年3月QCon上一个演讲, LMAX是一种新的零售的金融交易平台。它的业务创新 – 允许任何人在一系列的金融衍生产品交易。这就需要非常低的延迟,非常快速的处理,因为市场变化很快,这个零售平台因为有很多人同时操作自然具备了复杂性,用户越多,交易量越大,不断快速增长。

鉴于多核心思想的转变,这种苛刻的性能自然会提出一个明确的并行编程模型 ,但是他们却提出用一个线程处理6百万订单,而且是每秒,在通用的硬件上。

通过低延迟处理大量交易,取得低延迟和高吞吐量,而且没有并发代码的复杂性,他们是怎么做到呢?现在LMAX已经产品化一段时间了,现在应该可以揭开其神秘而迷人的面纱了。

阅读全文

Dissecting the Disruptor: Demystifying Memory Barriers

原文地址:http://mechanitis.blogspot.com/2011/08/dissecting-disruptor-why-its-so-fast.html (因有墙,移到墙内)

My recent slow-down in posting is because I’ve been trying to write a post explaining memory barriersand their applicability in the Disruptor. The problem is, no matter how much I read and no matter how many times I ask the ever-patient Martin and Mike questions trying to clarify some point, I just don’t intuitively grasp the subject. I guess I don’t have the deep background knowledge required to fully understand.

So, rather than make an idiot of myself trying to explain something I don’t really get, I’m going to try and cover, at an abstract / massive-simplification level, what I do understand in the area.  Martin has written a post going into memory barriers in some detail, so hopefully I can get away with skimming the subject.

阅读全文

Dissecting the Disruptor: Why it’s so fast (part two) – Magic cache line padding

原文地址:http://mechanitis.blogspot.com/2011/07/dissecting-disruptor-why-its-so-fast_22.html(因有墙移到墙内)

We mention the phrase Mechanical Sympathy quite a lot, in fact it’s even Martin’s blog title.  It’s about understanding how the underlying hardware operates and programming in a way that works with that, not against it.

We get a number of comments and questions about the mysterious cache line padding in theRingBuffer, and I referred to it in the last post.  Since this lends itself to pretty pictures, it’s the next thing I thought I would tackle.
阅读全文

Dissecting the Disruptor: Why it’s so fast (part one) – Locks Are Bad

原文地址:http://mechanitis.blogspot.com/2011/07/dissecting-disruptor-why-its-so-fast.html(因前方有墙,所以我移到墙内)

Martin Fowler has written a really good article describing not only the Disruptor, but also how it fits into the architecture at LMAX.  This gives some of the context that has been missing so far, but the most frequently asked question is still “What is the Disruptor?”.

I’m working up to answering that.  I’m currently on question number two: “Why is it so fast?”.

 

These questions do go hand in hand, however, because I can’t talk about why it’s fast without saying what it does, and I can’t talk about what it is without saying why it is that way.

So I’m trapped in a circular dependency.  A circular dependency of blogging.

To break the dependency, I’m going to answer question one with the simplest answer, and with any luck I’ll come back to it in a later post if it still needs explanation: the Disruptor is a way to pass information between threads.
阅读全文

并发译文翻译计划(二)

Doug Lea 的文献

  1. Synchronizer Framework  译者:ClarenceAu (已翻译完成,在校对)
  2. Fork/Join  译者:Alex(陆续发表中)
  3. Java Concurrency Constructs 译者:萧欢(已翻译完成)
  4. Cancellation 译者:丁一  (已翻译完成)

以下文章来自:https://code.google.com/p/disruptor/wiki/BlogsAndArticles

如何使用Disruptor

  1. What’s so special about a ring buffer? – A summary by Trisha of the data structure at the heart of the Disruptor patter, how it’s implemented and what’s so great about it. (译者:淘宝-欧立勇)
  2. How do I read from a ring buffer? – Trisha gives an overview of the Consumer and ConsumerBarrier, which allows you to read stuff off the ring buffer.(译者:古圣昌)
  3. Writing to the ring buffer – The third piece from Trisha explaining how to write to the ring buffer, and how it avoids wrapping.(译者:长源)
  4. Lock-free publishing – Danny outlines the concepts behind putting items into the ring buffer.(译者:行知)
  5. DSL for wiring up the Disruptor – Adrian came up with a cunning way to configure your Disruptor(译者:杨帆)
  6. Disruptor wizard now part of the Disruptor – Adrian’s wizard now makes it easy to configure your very own Disruptor straight out of the box (译者:杨帆)
  7. Disruptor version 2.0 – Trisha outlines the cosmetic changes to the Disruptor in version 2.0.(译者:杨帆)
  8. Sharing Data Among Threads Without Contention – An updated and summarised version of Trisha’s blogs in Oracle’s Java Magazine.(译者:同杰)

Disruptor为什么这么快

  1. Locks Are Bad – Trisha gives some basic concurrency background and explains why locks are evil. (译者:nick,潘曦,已经翻译完成)
  2. Magic cache line padding – An explanation around why the odd cache line padding variables are required, by Trisha.(译者:方腾飞,已经翻译完)
  3. Demystifying Memory Barriers – Trisha attempts to explain why memory barriers are important in the Disruptor. (译者:杜建雄)

其他人写的Disruptor文章

  1. LMAX 架构  by Martin Fowler (已翻译)
  2. Processing 1m TPS with the Axon Framework using the Disruptor.(译者,程晓明)

有兴趣的同学可以一起参与,有什么其他并发文献希望我们翻译的也可以通过留言告知我们。

如何翻译

  1. 你可从以上几篇文章中挑选某一篇进行翻译,翻译时间最好是一个星期以内,翻译前请发邮件到main_shorttime(AT)163.com告诉我你要翻译的文章和预计完成时间。
  2. 译者署名的顺序由翻译的字数确定。
  3. 与其他译者交叉校对,互相讨论翻译与技术问题。
  4. 提交翻译:在并发编程网用QQ登陆,然后发布译文。

注意事项

  1. 本文档的传播是基于学习研究而非商业,因此翻译纯属兴趣和分享精神。
  2. 对译者的要求,因为我们是出于学习和研究目的,所以对译者没有很高的要求,只要你只要你对并发编程感兴趣,并且愿意用心来翻译文章,翻译完的文章首先自己能读明白就行,放心我们会进行校对。

聊聊并发(六)ConcurrentLinkedQueue的实现原理分析

本文是作者原创,首发于InfoQ:http://www.infoq.com/cn/articles/ConcurrentLinkedQueue

1.    引言

在并发编程中我们有时候需要使用线程安全的队列。如果我们要实现一个线程安全的队列有两种实现方式一种是使用阻塞算法,另一种是使用非阻塞算法。使用阻塞算法的队列可以用一个锁(入队和出队用同一把锁)或两个锁(入队和出队用不同的锁)等方式来实现,而非阻塞的实现方式则可以使用循环CAS的方式来实现,本文让我们一起来研究下Doug Lea是如何使用非阻塞的方式来实现线程安全队列ConcurrentLinkedQueue的,相信从大师身上我们能学到不少并发编程的技巧。
阅读全文

看动画学并发编程

Java提供了并发库简化了并发编程,但这是很难用可视化的方式来学习。 Java Concurrent Animated项目用一系列的动画来演示每个java并发库组件和代码。看动画学并发编程

Java Concurrent Animated程序,为每一个并发组件的学习点,开发一个演示动画的程序,并配合代码和一张PPT进行知识点的说明。

官方网址是:http://sourceforge.net/projects/javaconcurrenta/

下载地址:http://sourceforge.net/projects/javaconcurrenta/files/latest/download?source=files

同步和Java内存模型

原文:http://gee.cs.oswego.edu/dl/cpj/jmm.html

作者:Doug Lea 译者:程晓明,萧欢,杜建雄  校对:方腾飞,丁一,欧振聪

目录

  1. 引言
  2. 原子性
  3. 可见性
  4. 有序性
  5. Volatile

Java内存模型Cookbook-前言

原文地址:http://gee.cs.oswego.edu/dl/jmm/cookbook.html

作者:Doug Lea。由 JMM邮件组的成员提供帮助. dl@cs.oswego.edu.

译者:潘曦,丁一,古圣昌,欧振聪,方腾飞  校对:欧振聪,方腾飞

前言:从最初的探索至今已经有十年了。在此期间,很多关于处理器和语言的内存模型的规范和问题变得更清楚,更容易理解,但还有一些没有研究清楚。本指南一直在修订、完善来保证它的准确性,然而本指南部分内容展开的细节还不是很完整。想更全面的了解, 可以特别关注下 Peter Sewell和 Cambridge Relaxed Memory Concurrency Group的研究工作。

这是一篇用于说明在JSR-133中制定的新Java内存模型(JMM)的非官方指南。这篇指南提供了在最简单的背景下各种规则存在的原因,而不是这些规则在指令重排、多核处理器屏障指令和原子操作等方面对编译器和JVM所造成的影响。它还包括了一系列遵循JSR-133的指南。本指南是“非官方”的文档,因为它还包括特定处理器性能和规范的解释,我们不能保证所有的解释都是正确的,此外,处理器的规范和实现也可能会随时改变。

  1. 指令重排 [译者:欧振聪]
  2. 内存屏障 [译者:潘曦]
  3. 多处理器 [译者:古圣昌]
  4. 指南        [译者:丁一]

并发译文翻译计划(一)

为了促进并发编程在中国的推广和研究,让更多的同学能阅读到国外的文献。所以打算将国外的编程文献翻译成中文,但是我一个人的精力有限,所以希望征集译者帮忙一起翻译。

阅读全文

Java内存模型FAQ

原文:http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html  译者:Alex,方腾飞

目录

  1. 什么是内存模型?
  2. 其他语言,像c++,也有内存模型吗?
  3. JSR 133是什么?
  4. 重排序是什么?
  5. 旧内存模型有什么错误?
  6. 没有正确同步的含义是什么?
  7. 同步会做些什么呢?
  8. final字段如何改变它们的值?
  9. 在新的JMM下final字段是如何工作的?
  10. volatile是干什么用的?
  11. 新内存模型是否修复了双重锁检查问题?
  12. 如果我要实现一个JVM,我需要做什么?
  13. 为什么要关注JMM?

Java内存模型FAQ(一) 什么是内存模型

原文:http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html 第一章 译者:方腾飞

在多核系统中,处理器一般有一层或者多层的缓存,这些的缓存通过加速数据访问(因为数据距离处理器更近)和降低共享内存在总线上的通讯(因为本地缓存能够满足许多内存操作)来提高CPU性能。缓存能够大大提升性能,但是它们也带来了许多挑战。例如,当两个CPU同时检查相同的内存地址时会发生什么?在什么样的条件下它们会看到相同的值?

阅读全文

并发编程推荐书籍和文章

1: java并发编程实战

Java并发编程实战

豆瓣地址:http://book.douban.com/subject/10484692/

2:多处理器编程的艺术

多处理器编程的艺术

豆瓣地址:http://book.douban.com/subject/3901836/

3:推荐系列文章

  1. IBM developerWorks 中国 : Java 多线程与并发编程专题 http://t.cn/SVFmtH
  2. 原阿里同事@武汉伢袁志俊 写的“探索并发编程”系列文章http://t.cn/aF7gqD
  3. 深入浅出java并发编程http://t.cn/hGJNqw by @饭饭泛

4:推荐精品文章

  1. 阿里同事悟时写的一种高效无锁内存队列的实现
  2. Hadoop并行计算原理与分布式并发编程 http://t.cn/zlsBCHk

return top