Difference between Fiware Scorpio Broker and Orion Broker - fiware

Multiple brokers are available over Fiware,
Which have better performance Fiware Scorpio Broker and Orion Broker?
Does Orion Broker is NGSI-LD compliance and what is its roadmap to achieve the NGSI-LD specification?

The FIWARE Catalogue currently contains four context brokers:
Orion - NGSI-v2 only
Orion-LD - mixed NGSI-LD and NGSI-v2 support
Scorpio - NGSI-LD only
Stellio - NGSI-LD only
Orion-LD is a fork from the original Orion repository and aims to be merged back at some point. It is the only context broker which can service both NGSI-v2 and NGSI-LD.
Scorpio and Stellio are pure NGSI-LD brokers which don't require the compromises of having to serve both syntaxes. Scorpio positions itself as the heavyweight broker, with a strong interest in federations. Stellio is somewhere in the middle between Scorpio and Orion.
All NGSI-LD brokers are trying to align to the ETSI standard, however new features are still being added (the latest ESTI update, the 1.3.1 specification was a couple of months ago). My understanding is that Orion complies with 95% of the 1.2.1 specification (excluding the temporal API). Scorpio is probably higher but some minor differences can be found within payloads
Running an ACID test NGSI-LD Test-Suite returns the following for Scorpio:
Test Suites: 1 failed, 36 passed, 37 total
Tests: 1 failed, 168 passed, 169 total
Snapshots: 0 total
Time: 38.595s
And the following for Orion-LD (where the majority of failed suites are for the optional temporal API which Orion-LD does not support directly)
Test Suites: 8 failed, 29 passed, 37 total
Tests: 22 failed, 147 passed, 169 total
Snapshots: 0 total
The roadmap for Orion-LD can be found here within the GitHub repository.

Related

How to send massive data of sensors in Orion

Let's suppose to have 100 sensors that send an attribute any second to Orion. How could I manage this massive data?
via batch operation (but I don't know if it can support them)
using an edge (to aggregate data) and sending to Orion (after 1 minute)
Thank you
Let’s consider 100 tps a high load for a given infrastructure (load and throughput must be always related to infrastructure and e2e scenarios).
The main problem you may encounter is not related to the update itself, Orion Context Broker and its fork Orion LD, can handle a lot of updates. The main problem in real/productive scenarios, like the ones handled by Orion Context Broker and NGSI v2, are the NOTIFICATIONS related to those UPDATES.
If you need a 1:1 (or even a 1:2 or 1:4) ratio between UPDATES:NOTIFICATIONS, for example you want to keep track of the history of every measure and also send the measures to the CEP for some post-processing, then it’s not only a matter of how many updates Orion may handle, but how many update-notifications the E2E can handle. If you got a slow notification endpoint Orion will saturate its notification queues and you will be losing notifications (not keeping track of those updates within en historic, or CEP…).
Batch updates are not helping on this since the UPDATE REQUEST SERVER is not the bottleneck and they are internally managed as single updates.
To alleviate this problem I should recommend you to enable NGSI V2 (only available in V2) flow control mechanism, so the update process may be automatically slowed down when the notification throughput requires so.
And of course, in any IoT scenario if you don’t need all the data the earlier you aggregate the better. So if your E2E doesn’t need to keep track of every single measure, data loggers are more than welcome.
For 100 sensors sending one update per second (did I understand that correctly?) ... that's nothing. The broker can handle 2-3 thousand updates per second running in a single core and with ~4 GB of RAM (mongodb needs about 3 times that).
And, if it's more (a lot more), then yes, the NGSI-LD API defines batch operations (for Create, Update, Upsert, and Delete of entities), and Orion-LD implements them all.
However, there's no batch op for attribute update. You'd need to use "batch update entity", the update mode (not replace). Check the NGSI-LD API spec for details.

How can one configure Context broker to transfer sensor data from FiROS to a database?

When we use the example tutorials given such as in
https://fiware-tutorials.readthedocs.io/en/1.0.0/time-series-data/index.html
we can perform sending data to Cratedb with no problem. However we are having difficulty to configure FiROS to subscribe to Context broker and have the Context broker notify CrateDB. Where should we focus in terms of this configuration ? The things to note:
We can see example robot sensor data generated with Gazebo simulator under FiROS
We can send an example manual dummy data via Postman messages directly to CB and perform subscriptions that can be notified to Quantum leap
somehow we can see FiROS gets subscription to CB however we cannot see that is notified to Cratedb via quantum leap
Any pointers would be much appreciated.
Thanks
If you are looking for a strategy for checking this, you can follow the paradigm described in the Debugging IoT Agents Webinar - it describes a scenario using MQTT topics rather than ROS, but the strategy is much the same.
Maximise your debug for all components - FIROS, Context Broker, QuantumLeap
Test sending a dummy measure direct into the Context Broker and check that it has arrived - this open issues around your containerization strategy (e.g. misuse of localhost)
Once you are able to send dummy messages directly, create the subscription and check that it is firing - this checks that the subscription is broad enough
Check that the subscription is being received properly - QuantumLeap could be misconfigured. Check the subscription for lastSuccess and failure
Briefly make a call to the QuantumLeap endpoints to check that data is received in the right format (e.g. make a lastN call or check the database directly.
At this point you can start connecting FIROS, ensure the appropriate topics are being monitored and check the logs.
This strategy should narrow down where in the chain of events the break is occurring and give you debug to work out what is going wrong. If necessary you could post some debug here on StackOverflow to give the community a chance to respond (at the moment it is impossible to tell where your system is breaking)
If the problem can be narrowed down to a single component, you could also consider raising an issue on the appropriate GitHub repository - e.g. FIROS or FIROS2

Difference btw Fiware GEris and GEi?

I studied through many websites about Fiware GEris and GEi ,but was not able to properly understand about them and their difference ??
One of them was : https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FIWARE_Frequently_Asked_Questions_(FAQ)
As explained at https://ask.fiware.org/question/1/what-is-a-fiware-ge-and-a-gei/:
A GE (whics stands for "Generic Enabler") is a sofware component definition based on an open specification. For example, the Publish/Subscribe Context Broker (sometimes referred as Context Broker for short) is one of the FIWARE GEs.
A GEi (which stands for "GE implementation) is a a particular implementation of a given GE. For example, Orion Context Broker is a GEi of the Publish/Subscribe Context Broker GE. A given GE may have several GEi (some of them even developed by third-parties outside FIWARE, given that the specifications in which a GE is based are open).
There is a third key term: GEri (which stands for "GE reference implementation"). A GEri is a particular GEi of a given GE which is provided by FIWARE as a reference implementation of that GE. For example, it happens to be that Orion Context Broker is not only a GEi for Publish/Subscribe Context Broker GE, but also a GEri for that GE.

Scalaz Streams vs Rx Java

Scalaz-streams is a young but very promising library for stream processing, while RxJava seems more mature and stable.
With my limited knowledge of both, I can see as an important difference the support that scalaz-streams offer for resource management.
What are the other key differences?
They both do offer resource management (see RxJava's unsubscription model)
The main difference between them is that scalaz-streams are pull based and RxJava is push based.
With pull based streams consumers control the action, in push based it's producers.
With push based streams you'll have to handle backpressure somehow (for example 1000s of open websocket connections that push data to your server), whereas with pull based streams backpressure is not a problem, the consumer is controlling the action.
More on push vs pull in this talk: http://www.youtube.com/watch?v=nCxBEUyIBt0

Are there any Python 2.7 alternatives to ZeroMQ that are released under the BSD or MIT license?

I am seeking Python 2.7 alternatives to ZeroMQ that are released under the BSD or MIT license. I am looking for something that supports request-reply and pub-sub messaging patterns. I can serialize the data myself if necessary. I found Twisted from Twisted Matrix Labs but it appears to require a blocking event loop, i.e. reactor.run(). I need a library that will run in the background and let my application check messages upon certain events. Are there any other alternatives?
Give nanomsg, a ZeroMQ younger sister, a try - same father, same beauty
Yes, it is licensed under MIT/X11 license.
Yes, REQ/REP - allows to build clusters of stateless services to process user requests
Yes, PUB/SUB - distributes messages to large sets of interested subscribers
Has several Python bindings available
https://github.com/tonysimpson/nanomsg-python (recommended)
https://github.com/sdiehl/pynanomsg
https://github.com/djc/nnpy
Differences between nanomsg and ZeroMQ
( state as of 2014/11 v0.5-beta - courtesy nanomsg.org >>> a-click-thru to the original HyperDoc )
Licensing
nanomsg library is MIT-licensed. What it means is that, unlike with ZeroMQ, you can modify the source code and re-release it under a different license, as a proprietary product, etc. More reasoning about the licensing can be found here.
POSIX Compliance
ZeroMQ API, while modeled on BSD socket API, doesn't match the API fully. nanomsg aims for full POSIX compliance.
Sockets are represented as ints, not void pointers.
Contexts, as known in ZeroMQ, don't exist in nanomsg. This means simpler API (sockets can be created in a single step) as well as the possibility of using the library for communication between different modules in a single process (think of plugins implemented in different languages speaking each to another). More discussion can be found here.
Sending and receiving functions ( nn_send, nn_sendmsg, nn_recv and nn_recvmsg ) fully match POSIX syntax and semantics.
Implementation Language
The library is implemented in C instead of C++.
From user's point of view it means that there's no dependency on C++ runtime (libstdc++ or similar) which may be handy in constrained and embedded environments.
From nanomsg developer's point of view it makes life easier.
Number of memory allocations is drastically reduced as intrusive containers are used instead of C++ STL containers.
The above also means less memory fragmentation, less cache misses, etc.
More discussion on the C vs. C++ topic can be found here and here.
Pluggable Transports and Protocols
In ZeroMQ there was no formal API for plugging in new transports (think WebSockets, DCCP, SCTP) and new protocols (counterparts to REQ/REP, PUB/SUB, etc.) As a consequence there were no new transports added since 2008. No new protocols were implemented either. The formal internal transport API (see transport.h and protocol.h) are meant to mitigate the problem and serve as a base for creating and experimenting with new transports and protocols.
Please, be aware that the two APIs are still new and may experience some tweaking in the future to make them usable in wide variety of scenarios.
nanomsg implements a new SURVEY protocol. The idea is to send a message ("survey") to multiple peers and wait for responses from all of them. For more details check the article here. Also look here.
In financial services it is quite common to use "deliver messages from anyone to everyone else" kind of messaging. To address this use case, there's a new BUS protocol implemented in nanomsg. Check the details here.
Threading Model
One of the big architectural blunders I've done in ZeroMQ is its threading model. Each individual object is managed exclusively by a single thread. That works well for async objects handled by worker threads, however, it becomes a trouble for objects managed by user threads. The thread may be used to do unrelated work for arbitrary time span, e.g. an hour, and during that time the object being managed by it is completely stuck. Some unfortunate consequences are: inability to implement request resending in REQ/REP protocol, PUB/SUB subscriptions not being applied while application is doing other work, and similar. In nanomsg the objects are not tightly bound to particular threads and thus these problems don't exist.
REQ socket in ZeroMQ cannot be really used in real-world environments, as they get stuck if message is lost due to service failure or similar. Users have to use XREQ instead and implement the request re-trying themselves. With nanomsg, the re-try functionality is built into REQ socket.
In nanomsg, both REQ and REP support cancelling the ongoing processing. Simply send a new request without waiting for a reply (in the case of REQ socket) or grab a new request without replying to the previous one (in the case of REP socket).
In ZeroMQ, due to its threading model, bind-first-then-connect-second scenario doesn't work for inproc transport. It is fixed in nanomsg.
For similar reasons auto-reconnect doesn't work for inproc transport in ZeroMQ. This problem is fixed in nanomsg as well.
Finally, nanomsg attempts to make nanomsg sockets thread-safe. While using a single socket from multiple threads in parallel is still discouraged, the way in which ZeroMQ sockets failed randomly in such circumstances proved to be painful and hard to debug.
State Machines
Internal interactions inside the nanomsg library are modeled as a set of state machines. The goal is to avoid the incomprehensible shutdown mechanism as seen in ZeroMQ and thus make the development of the library easier.
For more discussion see here and here.
IOCP Support
One of the long-standing problems in ZeroMQ was that internally it uses BSD socket API even on Windows platform where it is a second class citizen. Using IOCP instead, as appropriate, would require major rewrite of the codebase and thus, in spite of multiple attempts, was never implemented. IOCP is supposed to have better performance characteristics and, even more importantly, it allows to use additional transport mechanisms such as NamedPipes which are not accessible via BSD socket API. For these reasons nanomsg uses IOCP internally on Windows platforms.
Level-triggered Polling
One of the aspects of ZeroMQ that proved really confusing for users was the ability to integrate ZeroMQ sockets into an external event loops by using ZMQ_FD file descriptor. The main source of confusion was that the descriptor is edge-triggered, i.e. it signals only when there were no messages before and a new one arrived. nanomsg uses level-triggered file descriptors instead that simply signal when there's a message available irrespective of whether it was available in the past.
Routing Priorities
nanomsg implements priorities for outbound traffic. You may decide that messages are to be routed to a particular destination in preference, and fall back to an alternative destination only if the primary one is not available.
For more discussion see here.
TCP Transport Enhancements
There's a minor enhancement to TCP transport. When connecting, you can optionally specify the local interface to use for the connection, like this:
nn_connect (s, "tcp://eth0;192.168.0.111:5555").
Asynchronous DNS
DNS queries (e.g. converting hostnames to IP addresses) are done in asynchronous manner. In ZeroMQ such queries were done synchronously, which meant that when DNS was unavailable, the whole library, including the sockets that haven't used DNS, just hung.
Zero-Copy
While ZeroMQ offers a "zero-copy" API, it's not true zero-copy. Rather it's "zero-copy till the message gets to the kernel boundary". From that point on data is copied as with standard TCP. nanomsg, on the other hand, aims at supporting true zero-copy mechanisms such as RDMA (CPU bypass, direct memory-to-memory copying) and shmem (transfer of data between processes on the same box by using shared memory). The API entry points for zero-copy messaging are nn_allocmsg and nn_freemsg functions in combination with NN_MSG option passed to send/recv functions.
Efficient Subscription Matching
In ZeroMQ, simple tries are used to store and match PUB/SUB subscriptions. The subscription mechanism was intended for up to 10,000 subscriptions where simple trie works well. However, there are users who use as much as 150,000,000 subscriptions. In such cases there's a need for a more efficient data structure. Thus, nanomsg uses memory-efficient version of Patricia trie instead of simple trie.
For more details check this article.
Unified Buffer Model
ZeroMQ has a strange double-buffering behaviour. Both the outgoing and incoming data is stored in a message queue and in TCP's tx/rx buffers. What it means, for example, is that if you want to limit the amount of outgoing data, you have to set both ZMQ_SNDBUF and ZMQ_SNDHWM socket options. Given that there's no semantic difference between the two, nanomsg uses only TCP's (or equivalent's) buffers to store the data.
Scalability Protocols
Finally, on philosophical level, nanomsg aims at implementing different "scalability protocols" rather than being a generic networking library. Specifically:
Different protocols are fully separated, you cannot connect REQ socket to SUB socket or similar.
Each protocol embodies a distributed algorithm with well-defined prerequisites (e.g. "the service has to be stateless" in case of REQ/REP) and guarantees (if REQ socket stays alive request will be ultimately processed).
Partial failure is handled by the protocol, not by the user. In fact, it is transparent to the user.
The specifications of the protocols are in /rfc subdirectory.
The goal is to standardise the protocols via IETF.
There's no generic UDP-like socket (ZMQ_ROUTER), you should use L4 protocols for that kind of functionality.