Solace JCSMP API vs Java RTO API use cases/differences
Can some one Elaborate me the distinction between Solace JCSMP API and Java RTO API . Please elaborate use cases as well i.e. when to use which One as both are Java based implementation . Java RTO is wrapper over C API .
Best Answer
-
Hi @amishra ,
The Java RTO API was created to provide a very low and (importantly) predictable & consistent latency API to PubSub+ for those that still wanted to code in Java. So while JCSMP is also fairly low latency, it's affected by garbage collection on the JVM which can affect latency consistency.The use cases for Java RTO are the same as for the C-API... applications that are looking for the lowest latency and highest throughput. Typically we see this in financial trading apps and similar apps that are sensitive to latency and operate in "real time" as the RT stands for.
Keep in mind that although Java RTO is Java, being JNI, it looks very different than JCSMP (and "regular" Java) code. In order to keep the latency in check and not subject to garbage collection, the parts of your application that interact/process the messages should be coded in the same style. Otherwise you will introduce the same inconsistencies in latency via your application code.
If you are a Java developer looking for the most Java-like experience, I would suggest sticking with JCSMP... unless your use case demands the very lowest latency possible, which is what Java RTO was designed for. JCSMP is no slouch either, but it is subject to garbage collection.
12
Answers
-
Hi @amishra ,
The Java RTO API was created to provide a very low and (importantly) predictable & consistent latency API to PubSub+ for those that still wanted to code in Java. So while JCSMP is also fairly low latency, it's affected by garbage collection on the JVM which can affect latency consistency.The use cases for Java RTO are the same as for the C-API... applications that are looking for the lowest latency and highest throughput. Typically we see this in financial trading apps and similar apps that are sensitive to latency and operate in "real time" as the RT stands for.
Keep in mind that although Java RTO is Java, being JNI, it looks very different than JCSMP (and "regular" Java) code. In order to keep the latency in check and not subject to garbage collection, the parts of your application that interact/process the messages should be coded in the same style. Otherwise you will introduce the same inconsistencies in latency via your application code.
If you are a Java developer looking for the most Java-like experience, I would suggest sticking with JCSMP... unless your use case demands the very lowest latency possible, which is what Java RTO was designed for. JCSMP is no slouch either, but it is subject to garbage collection.
12 -
Hi @amackenzie ,
I'm thinking to try RTO, but cannot find how can I acknowledge messages manually. Could you please clarify that?
And also I'm interested in some performance numbers between Java RTO and Java API.Thanks
0 -
@spyroid what kind of performance? Throughput or latency? How fast do you need? What type of app are you building?
For all the difficulties of using the JNI-wrapped wrapper, I'd always suggest trying out the "regular" JCSMP API first, to see if it has the performance to meet your needs. it might be fast enough? For example, I wrote this simple code to get almost 250,000 msg/s (at 300 byte messages) for Direct messages from a single producer and single consumer: https://solace.community/discussion/comment/503#Comment_470
I still have to finish the equivalent Guaranteed producer & consumer test code.
Oh, and re: how to ACK messages? https://docs.solace.com/Solace-PubSub-Messaging-APIs/API-Developer-Guide/Acknowledging-Messages.htm
0 -
Throughput, I need as fast as possible. I did sample code (get message and acknowledge) using solace-jms-spring-boot-starter and got about 30k per second.
I'm intetersted if JCSMP API is faster then JMS API.0 -
JCSMP is generally much faster than JMS. There is a Spring Boot Starter for Java/JCSMP also. You might want to give that a try.
Also, you seem to indicate that throughput is the performance you are looking for. Java RTO, being based on the C API is going to give you lower, more consistent latency but JCSMP is very solid at throughput.
It would be good to know what your expectations on throughput are as well. Are you going to use a single client or multiple? There is only so fast a single client will go.0