This topic presents frequently asked questions about StreamBase clients.
Q: For Java clients, do you recommend that we use the client or server VM?
A: For best performance, we recommend you use the
-server option with the
java command, to select the server VM.
Q: Is it okay for multiple enqueue clients to send tuples into the same
InputStream? That is, does StreamBase guarantee to be able to construct a single stream out of tuples sent by multiple enqueue clients,
without any tuple corruption?
A: Yes - multiple clients may enqueue tuples into the same
InputStream, and tuples will not be corrupted.
Q: Because it's okay for multiple clients to enqueue to the same
InputStream, what ordering guarantees are made with respect to the enqueued tuples? The assumption is that the StreamBase Client library
makes no promises with regards to inter-client ordering of such tuples, but that the per-client ordering would be preserved.
Are both those assumptions correct?
A: Those assumptions are correct. Per-client ordering is guaranteed, but inter-client ordering is not guaranteed.
Note that per-client ordering is guaranteed only as long as all the tuples are on the same stream. The StreamBase Server make no guarantees with regard to the ordering of tuples on different input streams, regardless of how they were enqueued. This applies to internal streams (arcs) as well; tuples flowing on parallel arcs are unordered with respect to each other. The only guarantee is that operators will preserve the order of their input tuples when producing output tuples.
Q: When multiple clients dequeue from the same
OutputStream, does each client get its own independent copy of the tuples that flow out of the
A: Yes, that statement is correct.
Q: Can clients enqueue from different threads in the same client process?
StreamBaseClient class is single-threaded, which means that you cannot simultaneously use a particular
StreamBaseClient instance concurrently from multiple threads. However, you may create and use separate
StreamBaseClient objects in separate threads, provided that no two threads are using the same
For instance, you could share a
StreamBaseClient across any number of threads as long as you guard the
StreamBaseClient object with a mutex. That is, you must have each thread allocate the mutex before performing any operation on the object.
Or you could give each thread its own
For essential reference information about threading in clients, see the StreamBaseClient class in the Java Client library reference documentation.