I agree with Tomasz that there are changes that are definitely needed
given how much technology has changed since jabberd2 was first released.
Re 1. Merging separate daemons to one.
I am not sure if merging them into one process is the best idea. It sure is
convenient, but isolation is a nice thing to have. Specially, when you
have unauthorized users hammering on C2S. To be honest, I believe, that
instead of going micro – go macro. Think distributed scalable server platform
rather than ease of running on one machine. In today’s services oriented world,
this approach will find a better home I believe. Which brings me to router.
Today, it’s a bottleneck. There are several ways, as mentioned in Tomasz’s
email, to fix this issue and something that would be great to tackle this as
part of this re-architecture. MoongooseIM is a good place to look at for
scalable XMPP platform architecture.
4. Configuration interface
Subscription based model works well and its okay to force developers
to write config change handlers. It’s 2016, time to not argue about this
point given the advantages.
5. JavaScript support.
Personally, C/C++ is fine, however, if folks insist, would be good to keep
the existing setup and allow for JS SM components as a compile
time option.
6. String handling
Something that would be nice to see is allowing SM modules or others
to pre-process the PKT to extract as much meaningful data once (in the
beginning) and then passing that object around. Currently, at each
stage of the SM module call chain, we have to re-process the PKT or NAD
to extract the same data over and over again. Unnecessary work that
can be avoided easily. Easy to do in C++ but a bit awkward in C.
On 5/30/16, 1:31 AM, "Tomasz Sterna" wrote:
>There are some things we already talked about on Gitter channel [1],
>but I would like to raise them on the ML for peer review.
>
>As you can see from late activity, jabberd2 project is far from dead.
>With the inclusion of new features like WebSocket support, C99 code
>compatibility, IPv6 improvements, modern TLS handling, SASL Anonymous,
>password hashing, CRAM-MD5 and more... it is not a stale codebase
>anymore.
>
>But it is far from modern too...
>There are some changes I would like to introduce in the near future and
>I would like to hear your thoughts about:
>
>1. Merging separate daemons to one.
>Current design of jabberd2 with separate router, sm, c2s, s2s processes
>is designed to allow nice separation of concerns and distribution of
>processing. Separate processes are proved to be better approach than
>threads too.
>But most installations of jabberd are not distributed, with one
>instance of each component. Especially when c2s and sm got vhost
>support and are able to handle more than one domain.
>Also, modern OS architectures are tuned for event processing rather
>than multithreading, so event based architecture is better suited for
>them. Even jabberd2 process internally is event based on MIO.
>So, it makes sense to allow for running all component instances in one
>process, especially on amateur, low load servers.
>Merging processes will allow for having one main loop only, so
>maintaining bugfixes in it will be easier (main.c of all processes is a
>copy-paste, with all the bugs, so bugs are also multiplied).
>
>2. Phasing out MIO.
>This is closely related to above. MIO used by jabberd2 does not have
>clerar main loop support, which is implemented separately in each
>component main.c and is hardly pluggable.
>Also, the way MIO is implemented (in .h file, with platform specific
>bits in .c) makes it a maintanance nightmare.
>I would really like to replace it with a modern, upstream maintained
>event library. The nicest one I know is libuv, which also gives us nice
>platform independence layer.
>I already have a working c2s port to libuv as a PoC.
>
>3. Phasing out router.
>router component is the one binding all the others.
>In current design it is the single point of failure. Other components
>already support multiple instances, but router proved to be difficult
>to multiply.
>The most radical, yet compelling solution to this problem is getting
>rid of the router at all. There are many cooked solutions for local
>packet distribution, which Local Message Bus [2] looks like most
>promising solution. I would see either Mbus [3] or NN_BUS [4] taking
>role of router component.
>The added advantage of using a Message Bus is the ability to connect to
>the bus with alternative implementations to perform own actions.
>i.e. having the ability to use CLI tools to eavesdrop and send messages
>to the bus proved to be priceless when I implemented a PoC of the Bus
>in experimental jabberd branch.
>Bus also solves the problem of distribution - it is up to the
>deployment administrator whether one sets up local, one-machine only
>bus or a network distributed one.
>
>4. Configuration interface.
>A the moment jabberd is configured with static XML files loaded at