首页 > 编程语言 > 详细

[java,SDP] java 7 SDP 技术/Socket Direct Protocol 1

时间:2015-06-20 02:20:00      阅读:376      评论:0      收藏:0      [点我收藏+]
通过翻译文章学到的知识要远比看书或是其他渠道要快,特此来翻译一下加深学习与理解.

原文链接 : http://www.infoq.com/articles/Java-7-Sockets-Direct-Protocol

这篇文章主要介绍的是,Java 7 版本中新增了一个可以实现运行在两个虚拟机上的 Java 应用程序在某些特定型号的操作上
可以实现无需经由操作系统内核操作的网络数据通信,而是实现两个运行的程序的内存中的数据直接交换这样一种技术。
以及关于 Java 7 的 SDP 如何实现最大功率使用 InfiniBand 底层数据通信带宽资源,和 Java 7 实现 SDP 技术的原理.

Java 7 Sockets Direct Protocol -- Write Once, Run Everwhere ... and Run ( Some Places) Blazingly

This article will survey the new Java Sockets Direct Protocol (SDP) technology,       
a very exciting breakthrough that was recently introduced in the Java 7 SDK.
这篇文章将会简单介绍一下,最近被引入到 Java SDP 中的 SDP 技术,以及该技术在网络通信领域取得一系列令人振奋的突破

SDP empowers the Ultra High Performance Computing(UHPC) community
to use Java‘s ubiquitously common features and merits for a very uncommon use case : native access to the InfinBand Remote Direct Memory Access (RDMA) capability.
SDP 将其使用权授予 超高性能计算社区 , 让他们来将 java 的广泛使用的普通特点和优势用于解决一个并不普通的问题:通过本地访问 InfinBand 来实现远程内存字节访问 功能.

RDMA provides a protocol for low-latency applications to directly access memory on other computers without
involving the operating system.
基于 RDMA 这种技术实现了的协议可以让编写的应用程序通过直接访问其他主机中的内存来降低程序的低-延迟率
,在访问其他主机中内存的全程无需操作系统参与其中。

The UHPC community has the most stringent non-compromising low-latency and high throughput demands imaginable,
so it is natural that the UHPC needs the very best RDMA capability available.

高性能计算组对程序的低延迟率有着严格的限制,且对程序的吞吐量有着极高的要求,
所以高性能计算组迫切地希望 RMDA 技术可被实现并投入使用的心情是可想而知的.


With the introduction of the Java 7 Sockets Direct Protocol offering ,the UHPC needs the Java 7 Sockets Direct Protocol offering ,
the UHPC community now has a Java platform that enables them to write Java application code that directly joins
to the full power of the native InfiniBand RDMA capability .


随着Java 7 版本中提供的 SDP 技术的不断推广,高性能计算组越发觉得需要 Java 7 中所提供SDP 这个技术有用,
高性能计算组现在已经有一个 java 开发的平台,这个平台可以让高性能计算组的人员编写出的 java 应用程序代码可以直接将通过本地连接的 InfinBand
来实现 RDMA/ 远程内存直接访问 这一方发的功率开到最大

<也就是说, UHPC  通过这个 java 开发平台开发出的 java 程序可以充分的利用 InfinBand 所提供的带宽资源 ,这种情况下软件可以完美的和硬件相匹配>


Before we dive deeply into the new Java Sockets Direct Protocol , let‘s briefly revies Java‘s networking and sockets API history.
在我们深入了解新一代的 Java SPD 技术之前,我们来简短的回顾一下 java 网络编程以及 java 中的套接字接口的演变历史。

In 1995 Sun Microsystems introducted the world to Java and immediately began trumpeting the platform with the universally recognizable
catch prase ‘Java -- Write Once, Run Everywhere‘.
在 1995 年 Sun Microsystem 向世界展示了 Java 之后,便立即开始以一句广泛流传的 ‘一次编译,到处运行‘ 的口号来大肆宣扬其开发平台,

As we all known , the idea behind this was simple : instead of writing applications in C++ code( which was devilishly difficult to bind/deploy with anything 
even close to a "run everywhere" portability) you could now write application code in something called Java , which would bind/deploy to a virtual machine
(not the underlying OS executing environment).
其实我们都知道,在这 ‘一次编译,到处运行‘ 背后的原理其实是十分简单的: 取代使用 C++ 编写代码而是用 java 编写出的不涉及到操作系统运行环境的这样的应用程序
是被绑定/部署到一个类似于位于操作系统和编译器之间的中间件的这样一个虚拟机上面的。
如果使用 C++ 代码来编写的应用程序是绝壁不够实现‘一次编写到处运行‘的,就连实现程序的可移植性都是勉勉强强。


This greatly liberated the Java application programmer from portability concerns, delegating sole custody of portability to the Java virtual machine(JVM).
而 java 的 ‘一次编写,随处运行‘ 的设计初衷与理念极大程度上解放了 Java 程序开发者对程序可移植性的关心度,
而把这个问题交付给 java 的虚拟机来解决.

The JVM made this promise :
If you could build/deploy Java code that worked on one Java VM(form some specific underlying OS) , the platform guaranteed that the exact some code would work on any OS(for which a compliant Java VM was available).

java 虚拟机甚至做出了这种保证:
只要你编写的 Java 代码可以在当前主机上的 JVM 上面被绑定(不过如果是操作系统级的 Java 代码的话另算/也就是前面所说的 Java 代码是不包括与操作系统相关的,如果是与操作系统相关的 Java 代码不能够确保在所有其他操作系统中的 JVM 都可以被绑定、执行的),JVM 可以确保你的代码无需作任何的修改,便可以在其他任何一台操作系统上面跑起来(当然,前提是这个操作系统要装 JVM )

No more conditional compilation and pre-processor macros were needed.
再也不同在你的代码中写上条件编译,以及定义一些预处理的宏啦!

(Anybody remember C++ and #ifdef hell? The JVM would now relieve application programmers of that cruel burden.)
(是否有人想起来了 C++ 中的 #ifdef ? JVM 为编程人员 去除 编写条件编译和宏定义 如此残酷的负担)


This was all extremely helpful and very well received by the applications programming community.
这种解决方案非常的有用,并且广受程序开发社区的欢迎.

As we all know, Java caught on quickly and intensely - globally embraced at a pace unmatched in the history of Computing‘s many , many programming language platforms.
正如我们所知,java 在世界范围内被迅速和热烈追捧的程度,在历史中还没有任何一种编程语言或是平台可与之相匹敌。

In the beginning , Sun offered the Java VM to run on exactly 3 operating systems:
(i) Solaris (ii) Linux , (iii) Windows.
在一开始, Sun 公司提供的 Java 虚拟机仅仅可以运行在 3 类操作系统之上: 1, Solaris 2, Linux  3,Windows

Because Microsoft had just a few years earlier (1993) delivered the WinSocket protocol stack with Windows, Windows could not do TCP/IP networking
(and through an API fully supported by Microsoft).
因为微软在 JVM 成型的早几年(1993)已经发布了适用于 Windows 平台下,名为 WinSocket 的协议栈, Windows 平台是无法使用 TCP/IP 网络传输协议的
(因此 ,微软编写一个API 来实现网络传输)

The various *nix system (of course ) had been doing TCP/IP since the 1970s.
各类 unix 系列的操作系统(理所应当支持网络传输协议,它们就是为此而生的)从 1970 年代开始就实现了 TCP/IP 的传输协议.

Microsoft introduction of WinSOCK was absolutely essential to Java becoming what it become.
正式由于 Microsoft 引入了 WinSOCK 协议栈才成就了今天我们所熟知的 Java .

Without WinSOCK you could not deliver a Windows VM that supported the java.net.* and the java.io.* APIs.
如果没有 WinSOCK 的话,你是无法在 Windows 系列的操作系统下面使用 java.net.* 和 java.io.* 来实现网路传输功能的.

Without WinSOCK , Java could not build a complete network capable VM that would run on the OS that monopolized the world‘s desktops.
如果没有 WinSOCk, java也无法在垄断世界范围内的台式机上构架出一套网络适配虚拟器出来,

Instead of Java reaching "maybe a million" desktops, with Windows now doing full TCP/IP, Java could now reach "maybe a billion" desktops.
随着 Windows 系列操作系统逐渐实现对 TCP/IP 传输协议的全面支持,Java 也从"使用者将近百万",变成了  "上百万使用人数".


Things have changed

Sure, Java is still "write once, run everywhere". 
是的,如今的 Java 仍然是那个  "一次编写,随处运行" 的 Java

Portability  is still a centrial priority. But , now with Java 7 and Sockets Direct Protocol a whole lot more can be done with the Java VM.
可移植性仍旧是 Java 关注的核心技术。 但是,现在又和 Java 版本 7 和它的 SDP 技术, JVM 便可以被用在更多的领域中大展身手了.


Portability is not the only priority ; now accommodating ultra-high performance use cases is a major priority for the
Java VM .
可移植性目前不是 Java 语言独自具有的特权,如今很好的适用于超高性能计算案例 才是 Java 虚拟机所具备的独一无二的特权.

With Sockets Direct Protocol the Java VM can now deliver the same Networking and Sockets APIs that directly access the native power of InfinBand.
自从 Java 中实现了 SDP 这一技术, Java 虚拟机无需变动任何网络和套接字函数包便可以实现从本地连接到 InfinBand上,并充分利用其所带来的网络资源 。

InfiniBand is much faster than Ethernet.
InfiniBand 的网络传输速度要远远高于 Ethernet/以太网

InfinBand is the physical network layer provider of choice to the UHP computing community .
InfinBand 工作在网络只能够的物理层中供 超高性能计算组 快速传输数据所用。

Shortly we will talk about exactly what InfinBand is and how the Java 7 VM empowers applications to use native InfiniBand capabilities.
我们马上就谈论这个 InfinBand 是什么以及被授予 Java 7 虚拟机权限的应用程序是如何从本地使用 InfiniBand 所提供的高效网络数据传输的。


One interesting thing to note (especially from an historical perspective) ; Java has decided to deliver the Sockets Direct Protocol on two operating systems.
值得注意的一件趣闻(特别是从历史角度来看), Java 一开始是打算在两类操作系统上来实现 SDP 技术.

The two operating systems supporting Java SDP are Solaris and Linux .
这两个被选定的用来实现 Java SDP 技术的操作系统分别是 Solaris 和 Linux


Solaris SDP support has been standard for all versions since Solaris 10.
Solaris 早在 Solaris 10 版本之后便开始的所有标准版就已经开始支持 SDP 技术了。

As long as you have a physical InfinBand NIC, Java 7 SDP will work out-of-the box.
只要你所在的网络中心在硬件上使用 InfinBand , Java 7 的SDP 技术立即就可以使用.

For Linux , SDP support is delivered via the Open Fabrics Enterprise Distribution package .
对于 Linux 操作系统实现对 SDP 技术的支持是通过分发 Open Fabrics 公司的软件包来实现的。

To check if your Linux version is configured with the OFED device drivers, and that you indeed have
a physical InfinBand NIC adapter, simply type

[
egrep "^[ \t]+ib" /proc/net/dev
]

要检查你所使用的 Linux 版本是否配有 OFED 设备驱动,可以简单的在控制台中输入一下的命令,不过前提是
你要满足具有 InfinBand 网络中心的适配器 这样的一个物理设备才行

If you get any output from this command , you are all set to use Java 7 SDP on this operating system.
如果输入如下命令之后,有相关的提示信息显示出来的话,直接在这个操作系统上使用 Java 7 SDP 就可以了.

It is important to note that all java.net.* and java.io.* application code will -- of course -- still run on Microsoft Windows using the Java 7 VM ,
but it will run without Sockets Direct Protocol ( and thus it will run with
Ethernet as the physical layer provider).
有一点需要注意的就是,所有使用 java.net.* 和 java.io.* 编写实现的程序仍旧会  -- 且一定会 --  运行在安有 Java 7 版本虚拟机的微软系列操作系统之上,
但是这些程序运行的方式并不是以 Socket Direct Protocol
(SDP)   的方式运行的
(这也就是说,这些应用程序在运行的时候仍旧会在物理层中使用 以太网作为网络传输数据的媒介 )


This will be true even if you are running on a Windows Server version that provides InfinBand support (via WinSOCK Direct).
即便是使用 java.net.* ,java.io.* 编写的程序运行在使用 InfinBand 的微软系列操作系统之上,它的底层通信
仍旧不会使用 SDP 技术,所这一点是肯定的(因为 SDP 只在 Linux 和 Solaris 上面实现了,没有在 WIndows 上实现,
所以就算是底层条件满足,但是内核条件不够的话,也没有办法使用)

Again everything will still run on Microsoft , it will just not run as fast as "some places" that are not Microsoft( i.e. *nix) .
没错,历史总是惊人的相似: Microsoft 可以支持你运行任何东西,但是就是没有在别的系统中运行的那么快(比如说像是
 *nix ,Linu* 这样的操作系统 )<感受到作者对 Microsoft 慢慢的恶意>


Things have ,indeed , changed .
如今的 Java 已不可同日而语

Let‘s now talk about Java‘s API bridge to the operating system‘s Network protocol stack .
现在让我们来谈谈, Java 的 API 是如何构架通向操作系统协议栈的桥梁

First , the standard Open Systems Interconnection model of Network layers is as follows .
首先,标准的网络开放系统互联 (OSI ) 模型描述如下所示:
#
 Layer
 Protocol
 Java  SDK  core APIs
7
 Application Layer
 HTTP,FTP, SSL, etc
 java.net.HttpURLConnectin ,
javax.servlet.HttpServlet
6
 Presentation Layer
 
 #no real distinction in Java between
Application/Presentation OSI layers
5
 Session Layer
 NetBios , RCP
 #no Java SDK core support for OSI session layer
4
 Transport Layer
 TCP,UDP
 java.net.Socket
java.net.ServerSocket
java.net.Datagram
3
 Network Layer
 IP
 java.net.InetAddress
2
 Data Link Layer
 PPP
 #no Java SDK core support for OSI physical layer
However ....
Java 7 Sockets Direct Protocol ( VM bridge from InfiniBand to java.net.*
and java.io.* core APIs)
1
 Physical Layer
 Ethernet/ InfiniBand



#
 层名称
 协议层
 每一层中 Java SDK 中实现的核心 API 描述
7
 应用层
 HTTP,FTP, SSL, etc
 java.net.HttpURLConnectin ,
  javax.servlet.HttpServlet
6
 表示层
 
   Java 实现的应该是 TCP/IP 四协议模型
  所以对于 Java SDK 的核心 API 来说,
  应用层和表示层是相同的
5
 会话层
 NetBios , RCP
Java SDK 中没有支持 OSI 会话层的 API
4
 传输层
 TCP,UDP
  java.net.Socket
  java.net.ServerSocket
  java.net.Datagram
3
 网络层
 IP
 java.net.InetAddress
2
 数据链路层
 PPP
 #no Java SDK core support for OSI data  link layer
  在  Java SDK 核心包中没有支持 OSI 模型中数据链路层的 API
1
 物理层
 Ethernet(以太网)/ InfiniBand
 #  在 Java SDK 核心包中没有支持 OSI 模型中物理层的 API
但是 !
Java 7 Sockets Direct Protocol ( VM bridge from InfiniBand to java.net.*
and java.io.* core APIs)
Java 7 版本中的 SDP (实现了 java.net.* 和 java.io.* 网络包中的 API 函数可以通过虚拟机来连接调用InfiniteBand 底层网络数据传输) 技术的出现,却改变了这一点


For the OSI Network Layers vies , the Java 7 Socket Direct Protocol capability takes Java application code as "close to the metal " as is possible .
Java SDP provides a *direct* (the ‘D’ in SDP) bridge from the application code, through the VM , to *native* , *physical* InfiniBand.
对于 OSI 网络分层模型的各种语言实现来说,就属 Java 7 中的 SDP 技术可以让 Java 编写出来的代码更加切近物理底层的应用
./metal == physical layer

Java SDP 为编写应用程序的代码 到本地 InfiniBand 物理层之间,使用 虚拟机 搭建了一座桥梁.

The Java 7 SDP  capability does this without the application having to change its use of the core java.net.* and java.io.* APIs.
Java 7  的 SDP技术可让原有的应用程序在无需修改任何一处调用 java.net.* 和 java.io.* 核心包 API 的代码的前提下,
就让 InfinBand 作为底层网络数据通信的媒介
为 Java 编写的应用程序所用

More than just that , by configuring the Java VM‘s specific join-point to the InfiniBand OS device driver and libraries (aka InfinBand‘s VERBs layer API)
the application  code‘s use of java.net.* and java.io.* - which is Java‘s API for Transport Layer OS resources (OSI layer 4) can by-pass the tranditional
network protocol stack (i.e. it can by-pass OSI layer 3 and by pass OSI layer 2 ) and go *directly* to InfiniBand (OSI layer 1 ).
不仅如此,通过配置 java 虚拟机,来明确指出哪些操作系统软件将参与使用 InfiniBand 操作系统的驱动设备,
以及指出使用 java.net.* 和 java.io.* 的
应用程序使用的是哪个函数库
(举一个函数库的例子 : aka InfinBands 的 VERBs 层上的 API ) -- 这也就是说, 用于传输层使用的的操作系统资源可以
绕过传统的网络协议栈
( 也就是说, 位于 OSI 第四层传输层上被 java API 所用的资源是可以依次绕过 OSI 的第 3,2 层) 直接到达 InfiniBand 层(也就是 OSI 模型中的第一层)

The performance implications and payoffs are very significant .
这种在技术的付出,在实现在性能提升方面收到的回报是极其可观的。


[java,SDP] java 7 SDP 技术/Socket Direct Protocol 1

原文:http://blog.chinaunix.net/uid-28595538-id-5088359.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!