`

Writing your own Java application on Exalogic using SDP

 
阅读更多

I've written before about how Exalogic enables Oracle Middleware products to use Sockets Direct Protocol (SDP) under the covers, rather than TCP-IP, to achieve lower latency communication over an InfiniBand network. Originally, the capability to leverage SDP was limited to Oracle internal-only APIs in the JRockit JVM (Java 1.6) and thus was only usable by Oracle products like WebLogic.

However, SDP support has now been added as a general capability to Java 1.7 (Hotspot JVM), thus enabling any standalone Java application to be written to take advantage of SDP rather than TCP-IP, over InfiniBand. I found a new tutorial, Lesson: Understanding the Sockets Direct Protocol, describing how to write a Java application that can use SDP, so I gave it a go on an Exalogic X2-2 machine. Below I've recorded the steps that I took to test this, in case it's useful to others.

To leverage SDP from your application, you can still use the same Java socket APIs as normal and simply use a configuration file to indicate that SDP should be employed, not TCP-IP. The tutorial I found shows how to provide the SDP configuration file, but doesn't provide Java code examples to test this. So first of all I quickly wrote Java main classes for a server and a client and tested that they worked correctly on my Linux x86-64 laptop when using just TCP-IP over Ethernet.

If you want to try it out yourself, you can download a copy of the test Java project I wrote from here. Below is the key part of my server class that receives a line of text from the client over a socket, prints this text to the console and then replies with an acknowledgement.

  try (ServerSocket serverSocket = new ServerSocket(port)) {
    info("Running server on port " + port);

    while (true) {
      try (Socket socket = serverSocket.accept();
           BufferedReader in = new BufferedReader(
              new InputStreamReader(socket.getInputStream()));
           PrintWriter out = new PrintWriter(
              new BufferedWriter(new OutputStreamWriter(
                socket.getOutputStream())))) {
        String msg = in.readLine();
        info("Server received message:  " + msg);
        out.println("ACKNOWLEDGED (" + msg + ")");
        out.flush();
      }
    }
  }

And below is the key part of my client class which sends a line of text over a socket to the server and prints out the response text it receives.

  info("Running client connecting to " + host + ":" + port);

  try (Socket socket = new Socket(host, port);
       PrintWriter out = new PrintWriter(new BufferedWriter(
          new OutputStreamWriter(socket.getOutputStream())));
       BufferedReader in = new BufferedReader(
          new InputStreamReader(socket.getInputStream()))) {
    info("Client sent message:  " + SEND_MESSAGE_TEXT);
    out.println(SEND_MESSAGE_TEXT);
    out.flush();
    info("Client received message:  " + in.readLine());
  }

The observant among you will notice that all of above is just standard Java 1.7 using java.net.* & java.io.* APIs. Nothing special.

I then moved the test client and server apps over to two Exalogic compute nodes. Actually the compute nodes were virtualised in this case, rather than physical, with each Oracle Linux OS running as a guest OS (vServer) on top of the OVM hypervisor. As instructed in the tutorial, I added the following JVM arguments to my bash scripts for starting the Java server and client applications so that they can use SDP:

  -Dcom.sun.sdp.conf=/u01/myshare/sdp.conf
  -Djava.net.preferIPv4Stack=true
  -Dcom.sun.sdp.debug

I slipped the com.sun.sdp.debug argument in there too, because that makes the JVM print some information to the console, indicating if SDP is being used by the app. I created the sdp.conf file at the location /u01/myshare/sdp.conf, with the following content:

  bind * *
  connect 192.168.0.101  1234

In the first line I tell the JVM that if an application opens a server socket listening to all local network interface IP addresses, it should use SDP. The second line tells the JVM that if an application opens a new socket to the remote host:port of192.168.0.101:1234, to use SDP. This is the host:port of one of the network interfaces on the vServer that my Java server will listen to, when it starts.

Then running my wrapper bash scripts to start the Java server main class with its SDP file present, on a vServer, and the Java client class, with its SDP file, on another vServer, I saw the following output:

  [paul@paul_vserver2]$ ./runserver.sh
    BIND to 0.0.0.0:1234 (socket converted to SDP protocol)
    INFO - Running server on port 1234
    INFO - Server received message:  Hello from Java socket client program

  [paul@paul_vserver1]$ ./runclient.sh
    INFO - Running client connecting to 192.168.0.101:1234
    CONNECT to 192.168.0.101:1234 (socket converted to SDP protocol)
    INFO - Client sent message:  Hello from Java socket client program
    INFO - Client received message:  ACKNOWLEDGED (Hello from Java socket client program)

As you can see the client successfully sends the server a message and receives a response. In bold I've highlighted the debug output from the JVM showing that SDP is being used. However, to prove that SDP is indeed being used I did some more analysis. Whilst my Java server class was still running with its server socket listening, I ran the following OS level networking command to see if my running application's SDP listener was present. The output displayed:

  [paul@paul_vserver2]$ sdpnetstat -al | grep sdp
    sdp  0   0 *:search-agent   *:*  LISTEN 

This shows my server process running listening on all local IP addresses using SDP. As soon as I kill my server process and run the sdpnetstat command again, no SDP listeners are shown.

To further help prove this, I started up the server again listening on SDP, but in the client vServer, I changed the SDP conf file to have a 'rubbish' connect value to force the client application to use TCP-IP. Upon running the client application again, I see the following error, because the client is trying to use TCP to talk to a remote SDP listener. Also, notice in bold, the JVM debug output showing that no SDP match was found in sdp.conf.

  [paul@paul_vserver1]$ ./runclient.sh
    INFO - Running client connecting to 192.168.0.101:1234
    CONNECT to 192.168.0.101:1234 (no match)
    java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
        at java.net.Socket.connect(Socket.java:579)
        at java.net.Socket.connect(Socket.java:528)
        at java.net.Socket.(Socket.java:425)
        at java.net.Socket.(Socket.java:208)
        at testsocketcomms.Client.sendMessage(Client.java:35)
        at testsocketcomms.Client.main(Client.java:21)

Anyway, that's pretty much it. Want to use SDP from a custom application on Exalogic? Just use standard Java socket programming, specify the right settings in a configuration file and off you go!

In the future I hope to revisit this topic and performance test a bespoke application under load, comparing the performance difference between using TCP-IP over InfiniBand and SDP over InfiniBand. However, developing a 'realistic' performance test application, that doesn't contain other more prevalent bottlenecks, is not a simple task, hence it's not something I could have quickly demonstrated here.

分享到:
评论

相关推荐

    Exalogic 简介

    《Oracle Exalogic 弹性云:集成设计与卓越性能》 Oracle Exalogic 弹性云,作为Oracle一体机的重要组成部分,代表了新一代数据中心基础设施的创新与突破。其核心优势在于深度集成的设计理念,结合高性能硬件与软件...

    Oracle中间件云服务器exalogic介绍.pdf

    Oracle 中间件云服务器 Exalogic 介绍 Oracle 中间件云服务器 Exalogic 是一款基于云计算技术的中间件解决方案,旨在帮助企业实现数据中心的整合和革命。该解决方案提供了一个标准化的平台,能够简化操作、提高效率...

    Oracle Exalogic 弹性云:X2-2 硬件概览

    Exalogic弹性云是专为运行基于Java的企业级应用程序而设计的优化平台,其核心优势在于高性能、高密度和高可维护性的系统设计。 #### 系统设计目标与原则 Exalogic弹性云X2-2的设计目标集中在几个关键领域: 1. **...

    Oracle Tuxedo与Exalogic平台白皮书.pdf

    【Oracle Tuxedo与Exalogic平台白皮书】提供了关于如何在Exalogic平台上部署和优化Oracle Tuxedo应用程序的深入见解。Oracle Tuxedo是一款成熟的企业级中间件,主要用于构建和运行关键任务的C、C++和COBOL应用。...

    Oracle Exalogic开启融合中间件即服务.pdf

    Oracle Exalogic是一款由甲骨文(Oracle)公司推出的融合中间件服务平台,旨在为企业提供高效、集成化的云计算基础设施。这款产品结合了先进的硬件和软件技术,优化了计算、存储和网络资源的交互,使得它成为云计算...

    甲骨文推出Oracle Exalogic中间件云服务器.pdf

    【Oracle Exalogic中间件云服务器】 甲骨文公司针对传统数据中心面临的挑战,如复杂的IT资源管理、海量数据处理、多平台和技术整合、绿色节能以及供应商协调等问题,推出了Oracle Exalogic中间件云服务器。这款产品...

    Oracle Exalogic:21世纪的中间件云服务器.pdf

    Oracle Exalogic是一款专为21世纪设计的中间件云服务器,它代表了现代数据中心的先进技术,旨在提高性能,降低成本,并实现高效的资源管理和自动化。Oracle Exalogic中间件云服务器特别针对大规模、关键任务部署而...

    甲骨文推出Oracle Exalogic中间件云服务器软件2.0.pdf

    甲骨文推出Oracle Exalogic中间件云服务器软件2.0.pdf

    oracle public cloud

    - **Exalogic On Demand**: 基于 Oracle Exalogic Elastic Cloud 的应用服务器云服务。 ##### 2. Private & Public Cloud Services Oracle Public Cloud 还提供了私有云与公有云相结合的服务方案,帮助企业实现...

    Oracle月度技术通讯

    8. **Java技术**:Oracle对Java的维护和更新也是通讯中的重要部分,可能涉及JDK的新版本、Java EE的进展等。 9. **企业资源规划(ERP)与客户关系管理(CRM)**:Oracle E-Business Suite和Siebel CRM可能有新的模块或...

    广东电信政企客户信息化Oracle合作交流讨论会--构建运营商主导的企业信息化市场生态圈.pdf

    " Oracle合作交流讨论会" 以下是根据给定的文件信息生成的知识点:...Oracle的其他解决方案包括了WebLogic Server、Exalogic、Exadata、ODI、GoldenGate等多个方面,为企业提供了全面的解决方案,帮助企业实现信息化。

    所有“云”方案的超集—Oracle的云战略.pdf

    其基础为Oracle数据库和Java EE技术,通过Oracle Exadata和Oracle Exalogic的集成,形成了一个基于WebLogic中间件和WebService接口的分布式云计算环境,其目标是构建一个应用程序即服务(ApplicationReady)的环境。...

    Built for Clouds - Oracle Solaris 11 and SPARC

    - **Exalogic OnDemand**:基于Oracle Exalogic弹性云服务器提供的服务,适用于复杂的业务逻辑处理。 - **Fusion HCM Cloud Service**、**Oracle Database Cloud Service**、**Oracle Java Cloud Service**、**...

    EBS MAA 架构讲解及配置

    - **Oracle Exalogic** 是一种专为运行企业应用而设计的集成系统,集成了硬件和软件优化,提供高性能和低延迟的环境,特别适合EBS。 - **Oracle Exadata Database Machine** 则是专为数据仓库和在线事务处理(OLTP)...

    2016 oracle大会资料

    4. **Java技术**:作为Java的创造者,Oracle在大会上可能深入讨论了Java平台的最新发展,包括Java SE(标准版)和Java EE(企业版),以及对开发者的重要性。 5. **大数据与分析**:Oracle的大数据解决方案,如...

    Oracle-WebLogic-Server-12c-各版本功能特性速查表

    - 包含ActiveGridLink for RAC,这是与Oracle Real Application Clusters (RAC)的高度集成解决方案,能为企业提供全面的高可靠性方案。 - 包括Oracle Exalogic弹性云,支持客户部署现代云基础架构。 2. Oracle ...

    Oracle安装教程pdf和使用手册

    接着,下载适合你操作系统的Oracle Database软件,根据教程中的指导运行安装程序,选择适当的安装类型,如"Single Instance"(单实例)或"RAC"(Real Application Clusters)集群。在安装过程中,你需要配置网络组件...

    Oracle_Fusion_Middleware_11g_介绍

    它涵盖了Oracle融合中间件、中间件云服务器Exalogic、以及与Oracle数据库的集成,旨在支持企业对于现代化应用的需求。在多核技术、虚拟化、云计算等新兴技术的推动下,Oracle Fusion Middleware 11g将有助于企业实现...

    weblogic性能调优(官方文档)

    针对Exalogic平台,启用“Exalogic Optimizations Enabled”标志可激活多项内核优化,包括纯Java NIO套接字合成器、分散读取、集中写入、JSSE作为SSL提供程序、无锁定请求管理器以及更积极的自调优线程算法,大幅...

Global site tag (gtag.js) - Google Analytics