Coder Social home page Coder Social logo

mylinyuzhi / aeron Goto Github PK

View Code? Open in Web Editor NEW

This project forked from real-logic/aeron

0.0 2.0 0.0 24.9 MB

Efficient reliable UDP unicast, UDP multicast, and IPC message transport

License: Apache License 2.0

CMake 0.61% Java 59.68% C++ 23.42% C 15.21% Shell 0.60% Batchfile 0.48%

aeron's Introduction

Aeron

Gitter To chat with other Aeron users and the contributors.

Efficient reliable UDP unicast, UDP multicast, and IPC message transport. Java and C++ clients are available in this repository, and a .NET client is available from a 3rd party. All three clients can exchange messages across machines, or on the same machine via IPC, very efficiently. Streams can be recorded to an Archive for later replay.

Performance is the key focus. Aeron is designed to be the highest throughput with the lowest and most predictable latency possible of any messaging system. Aeron integrates with Simple Binary Encoding (SBE) for the best possible performance in message encoding and decoding. Many of the data structures used in the creation of Aeron have been factored out to the Agrona project.

For details of usage, protocol specification, FAQ, etc. please check out the Wiki.

For those who prefer to watch a video then try Aeron Messaging from StrangeLoop 2014. Things have moved on quite a bit with performance and some features but the basic design still applies.

For the latest version information and changes see the Change Log with downloads at Maven Central.

How do I use Aeron?

  1. Java Programming Guide
  2. C++11 Programming Guide
  3. Best Practices Guide
  4. Monitoring and Debugging
  5. Configuration Options
  6. Channel Specific Configuration
  7. Aeron Archive

How does Aeron work?

  1. Protocol Specification
  2. Design Overview
  3. Design Principles
  4. Flow Control Semantics
  5. Media Driver Operation

How do I hack on Aeron?

  1. Hacking on Aeron
  2. Performance Testing

Build

Java Build

The project is built with Gradle using this build.gradle file.

You require the following to build Aeron:

  • Latest stable Oracle JDK 8, Java versions before 1.8.0_65 are very buggy and can cause tests to fail.

You must first build and install Agrona and Simple Binary Encoding (SBE) into the local maven repository

    $ ./gradlew

After Agrona & SBE is compiled and installed, then you can build Aeron.

Full clean and build of all modules

    $ ./gradlew

C++ Build

You require the following to build the C++ API for Aeron:

  • 3.0.2 or higher of CMake
  • C++11 supported compiler for the supported platform
  • C11 supported compiler for the supported platform
  • Requirements to build HdrHistogram_c. HdrHistogram requires zlib.h currently. So on Ubuntu:
    $ sudo apt-get install libz-dev

Note: Aeron is supported on Linux, Mac, and Windows. Windows builds require Visual Studio and are being developed with Visual Studio 2013 and 2015 with 64-bit builds only. Cygwin, MSys, etc. may work, but are not maintained at this time.

For convenience, a script is provided that does a full clean, build, and test of all targets as a Release build.

    $ ./cppbuild/cppbuild

If you are comfortable with using CMake, then a full clean, build, and test looks like:

    $ mkdir -p cppbuild/Debug
    $ cd cppbuild/Debug
    $ cmake ../..
    $ cmake --build . --clean-first
    $ ctest

C Media Driver

By default, the C Media Driver is not built as part of the C++ Build. However, it can be enabled via the CMake option BUILD_AERON_DRIVER being set to ON.

For convenience, a script is provided that does a full clean, build, and test of all targets as a Release build of the C++ API and the C Media Driver.

    $ ./cppbuild/cppbuild -b

If you are comfortable with using CMake, then a full clean, build, and test looks like:

    $ mkdir -p cppbuild/Debug
    $ cd cppbuild/Debug
    $ cmake -DBUILD_AERON_DRIVER=ON ../..
    $ cmake --build . --clean-first
    $ ctest

Note: C Media Driver is currently only supported on Mac and Linux.

For dependencies and other information, see the README.

Documentation

If you have doxygen installed and want to build the Doxygen doc, there is a nice doc target that can be used.

    $ make doc

Packaging

If you would like a packaged version of the compiled API, there is the package target that uses CPack. If the doc has been built previous to the packaging, it will be included. Packages created are "TGZ;STGZ", but can be changed by running cpack directly.

    $ make package

Running Samples

Start up a media driver which will create the data and conductor directories. On Linux, this will probably be in /dev/shm/aeron or /tmp/aeron.

    $ java -cp aeron-samples/build/libs/samples.jar io.aeron.driver.MediaDriver

Alternatively, specify the data and conductor directories. The following example uses the shared memory 'directory' on Linux, but you could just as easily point to the regular filesystem.

    $ java -cp aeron-samples/build/libs/samples.jar -Daeron.dir=/dev/shm/aeron io.aeron.driver.MediaDriver

You can run the BasicSubscriber from a command line. On Linux, this will be pointing to the /dev/shm shared memory directory, so be sure your MediaDriver is doing the same!

    $ java -cp aeron-samples/build/libs/samples.jar io.aeron.samples.BasicSubscriber

You can run the BasicPublisher from a command line. On Linux, this will be pointing to the /dev/shm shared memory directory, so be sure your MediaDriver is doing the same!

    $ java -cp aeron-samples/build/libs/samples.jar io.aeron.samples.BasicPublisher

You can run the AeronStat utility to read system counters from a command line

    $ java -cp aeron-samples/build/libs/samples.jar io.aeron.samples.AeronStat

Media Driver Packaging

The Media Driver is packaged by the default build into an application that can be found here

aeron-driver/build/distributions/aeron-driver-${VERSION}.zip

Troubleshooting

  1. On linux, the subscriber sample throws an exception

     java.lang.InternalError(a fault occurred in a recent unsafe memory access operation in compiled Java code)
    

    This is actually an out of disk space issue.

    To alleviate, check to make sure you have enough disk space.

    In the samples, on Linux, this will probably be either at /dev/shm/aeron or /tmp/aeron (depending on your settings).

    See this thread for a similar problem.

    Note: if you are trying to run this inside a Linux Docker, be aware that, by default, Docker only allocates 64 MB to the shared memory space at /dev/shm. However, the samples will quickly outgrow this.

    You can work around this issue by using the --shm-size argument for docker run or shm_size in docker-compose.yaml.

License (See LICENSE file for full license)

Copyright 2014-2018 Real Logic Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

aeron's People

Contributors

0xcafed00d avatar antrongladney avatar brianhorst avatar cesaref avatar didenko avatar erichocean avatar gitter-badger avatar jessefugitt avatar jh0x avatar johnpr01 avatar jpwatson avatar kdkavanagh avatar kudryashov avatar lbradstreet avatar lfn3 avatar m-1 avatar mikeb01 avatar mjpt777 avatar mst4 avatar nicklauslittle avatar nitsanw avatar oheger avatar raphw avatar richardwarburton avatar rlankenau avatar stanliberman avatar sthornington avatar strangelydim avatar tmontgomery avatar vksingh70 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.