
The HTTP bindings are handled by the ejabberd_http module. The server to server connection (typically on tcp/5269) is handled by the modules ejabberd_s2s, ejabberd_s2s_in, ejabber_s2s_out. The client to server connection (typically on tcp/5222) is handled by the module ejabberd_c2s. The logic layer is the main and most import part of the ejabberd system. Avoid relational data whenever possible (use key lookup) if you want to make good use of it. Generally, mnesia is suitable for real fast key-value searches, but performs pretty badly when you use it for “relational” lookups (using the mnesia:select the wrong way). For example, sometimes it might be more convienient to allow the user to authenticate using data stored in an existing database server, or there may be some relational data that need to be used for some purpose. However, ejabberd does not enforce its use it provides ODBC interfaces to allow utilizing of other databases whenever possible. Some of its features, such as replication and realtime searches, make it eligible for an extremely extensible database system. Extremely fast real time data searches.Programs can be written without knowledge of the actual location of data.
#Ejabberd stired users series#
A series of table manipulation operations can be grouped into a single atomic transaction. Tables may be replicated at several nodes. Mnesia is in fact a high-performance key-value pair storage system built into the erlang library. It handles all the incoming data from and the outgoing data to the client.Įjabberd primarily use mnesia as its “database”. This is the layer we have just talked about. It handles all the XMPP logics, as well as many other features, e.g.: http bindings, access controls, extensible modules and hooks, etc.

This layer is the most complicated of all. This layer handles how data get stored in databases, and ensures the integrity and constraints of data. Like many servers, ejabberd can inherently be broken up into three layers: This time let’s take a look at the ejabberd as a whole and try to figure out what it is about.

We have taken a quick tour through the socket infrastructure provided with ejabberd, and wrote a few listeners as an exercise.
