Welcome to AMPS!¶
AMPS, the Advanced Message Processing System, is a reliable high-performance publish and subscribe engine designed for real-world messaging applications that demand the highest performance and lowest latency possible. AMPS solves the hardest problems for modern pub/sub and queuing applications in a way that maximizes performance and reliability without compromising ease of use.
What makes AMPS different?¶
AMPS is designed for extremely demanding, real-world messaging applications. This means that AMPS has:
- Uncompromising focus on real-world needs
- Hardware-level optimization for performance
- Easy-to-use programming interface
- Detailed monitoring and diagnostics
- Complete solution for high-volume low-latency applications
- Durability and transactional consistency
- Both pub/sub and queuing delivery models
- Replication for high availability
- Persistent state-of-the-world database
- Content filtering with SQL92 WHERE clause semantics
- Topic views, projection and JOIN
- Message replay and historical point-in-time query
- Real-time computation and analysis using standard SQL semantics
- Delta publish and subscribe for lightweight updates
- Built-in handling for FIX, NVFIX, JSON, BSON, Google Protocol Buffer, MessagePack and XML messages
AMPS allows you to configure each server, topic, or view to use exactly the features that you need. This keeps AMPS programming and administration simple.
Get the Equipment¶
To get the most out of your evaluation, you will need:
- An installation of AMPS on a Linux host
- An Linux installation and a local installation of AMPS.
- If you do not already have a Linux installation, you can use a virtual machine, for example, VirtualBox available at http://virtualbox.org
- Make sure that Virtualization Technology is enabled on your development machine, as described at http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1003944
- Create a Virtual Machine with enough memory and disk space to hold the data you intend to use with your AMPS evaluation
- Install the Linux distribution of your choice
- Download the AMPS Linux distribution at http://crankuptheamps.com/evaluation
- An Linux installation and a local installation of AMPS.
- The AMPS C++ client (which this file is part of). Visit crankuptheamps.com to download the latest client distributions, server distributions, and documentation.
Turn It On¶
To install the Linux distribution of AMPS and start the evaluation server:
Extract the Linux distribution of AMPS and the AMPS client.
Make a config directory in the AMPS distribution directory, for example:
$ mkdir ~/amps_dir/config
Copy the
sample.xml
file from the samples directory into the config directory you just created, for example:$ cp sample.xml ~/amps_dir/config/sample.xml
Change directories to the AMPS distribution directory and start AMPS with the sample config file. For example:
$ cd ~/amps_dir/ $ ./bin/ampServer ./config/sample.xml
Crank It Up!¶
In this section, we describe using the AMPS samples from the command line. You can also use your IDE of choice, if you prefer.
To get started with AMPS, create a simple subscriber and publisher:
- Open a command shell
- Navigate to the directory where you unzipped the client distribution
- Navigate to
samples
Update the connection strings to connect to AMPS
FROM THE LINUX COMMAND LINE:
From the samples directory, type the following command to replace the IP address:
$sed -ri 's/127.0.0.1/ip address here/' *.cpp *.h
Build the samples
$ make
Run the sample subscriber
- From the samples directory, you can run the example by typing:
$ ./amps_subscribe &
This command line runs the subscriber, and then sends it to the background. Messages from the subscriber will be printed to the console. Of course, no messages will be received until a message is published.
Run the sample publisher
- From the samples directory, you can run the example by typing:
$ ./amps_publish &
- The program runs, and subscribers receive the Hello, World message. The publisher itself produces no output if it is successful. The subscriber will receive the message.
Using a State-of-the-World Database¶
One of the most useful parts of AMPS is being able to keep track of the current value of a message, using the state of the world (SOW) database:
Add messages to a state of the world database
- From the
samples
directory, run the publisher by typing:
$ ./amps_publish_sow &
- The program runs. This program sends 10,000 messages to AMPS, and then adds an optional field to some messages.
- From the
Retrieve the state of the world
- From the
samples
directory, run the query example by typing:
$ ./amps_query_sow &
- The program runs three queries on the SOW. The first query returns every message with a
messageNumber
that is evenly divisible by10
. The second query returns every message to which the optional field has been added. The last query retrieves messages with a messageNumber evenly divisible by 10 and an optional field.
- From the
AMPS also provides the ability to query the state of the world and then immediately subscribe to updates. When using this functionality, AMPS registers the subscription when it begins the query. Updates that occur while the query is running are delivered to the subscriber, in order, after the query results are returned.
Run the SOW and subscribe sample:
- From the
samples
directory, run the query example by typing:
$ ./amps_sow_and_subscribe &
- The program runs. The program simultaneously runs a query on the SOW and registers a subscription. The results of the query return immediately, and the program waits for additional messages to arrive.
- From the
Publish more messages to the SOW database.
- From the
samples
directory, run the SOW publisher by typing:
$ ./amps_publish_sow &
- The program runs. This program does not produce output, but instead publishes messages to AMPS. The program then updates the value of several messages and adds an optional field to those messages.
- The subscriber started in step 1 above will show messages that match the subscription filter as they arrive.
- From the
Message Replay with Client-Side State¶
AMPS features a fully queryable transaction log that allows you to replay messages from any point in time. To do this, you configure AMPS to save a transaction log for a specific topic or set of topics, then request a subscription from a point in time. AMPS replays the messages in the transaction log, and then continues the subscription for incoming messages.
The evaluation kit contains samples that demonstrate message replay. In addition, the subscriber keeps track of the messages received, so that the subscriber receives each message only once.
Publish messages to the transaction log.
From the
samples
directory, run a publisher that publishes messages to the transaction log.$ ./amps_publish_for_replay &
The program publishes 1000 messages at a time to the transaction log. Each message published has a unique orderId. The program waits for one second between sets of 1000 messages.
Wait for a few seconds, then replay the messages.
From the
samples
directory, run the replay subscriber by typing:$ ./amps_subscribe_with_replay
The program runs, and receives messages.
Stop the program by pressing Ctrl-C.
Run the program again by typing:
$ ./amps_subscribe_with_replay
The program resumes the subscription after the last received message.
Faster. Louder. Better.¶
From here, the world of AMPS is yours to explore. The Evaluation Kit gives you a set of guides to help you understand how AMPS works and what you need to do to take advantage of AMPS in your applications.
The AMPS User Guide describes the features of AMPS in detail, with a focus on helping you understand the concepts behind AMPS. The AMPS C++ Developer Guide describes the C++ interface for AMPS.
You know what your application needs. We’ve provided some suggestions for simple programs that will help you get familiar with AMPS and help you understand how AMPS can help you.
Suggested learning projects:
- Understanding the state of the world. Fill the SOW database with messages. Verify this using the amps_sow_dump tool, as you did for AMPSSOWPublisher. Update a few messages in the database. Verify the updates using the amps_sow_dump tool. Then write a program that uses SOW and delta subscriptions to get the same information.
- Working with multiple AMPS instances. Create an application that forwards selected messages from one AMPS instance to another.
- Working with views. Create a view in AMPS that does simple calculation on values within incoming messages. Create an application that uses a filtered subscription on the view to view messages where the calculated value is within a certain range. Modify the application to use an out-of-focus message to be notified when the calculated value is outside of that range.
- Try a message queue. The sample configuration has a queue named
sample-queue
defined for the JSON message type. Try sending a few messages to the queue, then starting a few subscribers to receive and acknowledge the messages. - Make a remix. Add
Enrichment
to one of theTopic
definitions in the state of the world and see how AMPS can enrich and annotate messages as they’re published to the server.
Keep It Going¶
Want to know more about how AMPS can help you build great applications? Still having trouble getting AMPS to play your tune? For help or questions, send us a note at support@crankuptheamps.com. And if AMPS ever overloads (produces a minidump), send the dump file to crash@crankuptheamps.com.