Hi Stefan,

On 3 November 2016 at 12:27, 'Stefan Sänger' via prosody-dev
<prosody-dev@googlegroups.com> wrote:
> Hi All,
> I am currently looking into some config and scaling options - the goal is to
> integrate prosody into some hosting scenario. In the end there is a
> webclient embedded into another application, and it is using BOSH to connect
> to prosody (with nginx doing SSL offloading).
> In one of my tests I tried to create a lot of VirtualHost configs - and to
> my surprise there seems to be a limit. While everything was pretty smooth
> for like 20 hosts, I really had problems with larger numbers. 500 hosts also
> does not seem to be a problem, but with 1000 hosts it basically stopped
> working.

There is no hard limit, and Prosody has been successfully used in
hosted scenarios with thousands of domains by others. Although there
is no hard limit, some things will not perform that great out of the
box. I'll share some tips.

The first thing I'll mention is that you're using 0.10 - and we're not
quite done with it yet, there are known performance issues, especially
if you're using SQL for storage. If you are, that's probably the #1
source of your problems right now.

We've done extensive tests in the past with Prosody serving thousands
of hosts. They caused us to make some architectural changes some years
ago to reduce per-host memory footprint and startup time. These are
the two places you are going to encounter any bottlenecks.

Starting with memory usage... the answer is simple. This depends on
what modules and features you have enabled in your configuration.
Really consider what you need and what you don't need to be loaded,
and trim back anything you don't need. That way you'll be able to
squeeze more hosts into your available RAM.

The second is startup time. Prosody has the concept of "active" and
"inactive" hosts, and when it activates a host there is some
initialization done (loading modules, etc.) for that host. By default
(because this is what most setups want) Prosody takes a very simple
approach and automatically activates all the hosts in the config file
at startup. If you have thousands of them, this is almost certainly
*not* what you want. It can take quite a while (again, depending on
your configuration - keep it minimal) before Prosody is ready to
accept connections.

We have made some utilities available for controlling this behaviour.
For example, you can use this small script in your config to load
hosts on-demand, instead of at startup:

Startup time with the above script will become instant again. When a
host is first accessed (e.g. user tries to log in) then it is
automatically activated. This spreads the load of activating hosts
over time, and ensures that only hosts that you actually use get
activated and use resources.

You also likely will want to dynamically add/remove hosts while
Prosody is running. For that you can take advantage of the fact that
the config file allows you to run Lua snippets. Using this feature you
can pull hosts dynamically from a file, database or external API
(caution: this technique is blocking, so make it a fast operation).
You can combine this with:
https://modules.prosody.im/mod_auto_activate_hosts.html (this module
is designed to be compatible with the lazyhosts script mentioned

> I increased RAM and adjusted limits for file descriptors, but it looks like
> even with 8G of RAM I am not able to connect anymore. I am currently trying
> with prosody 0.10.

Enable debug logs and figure out what's going on. If you can't figure
it out, use strace. However it is very likely to be SQL-related, or
the issues I described above. If none of this helps you though, get
some more details on why you are unable to connect and we'll figure it


You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prosody-dev+unsubscr...@googlegroups.com.
To post to this group, send email to prosody-dev@googlegroups.com.
Visit this group at https://groups.google.com/group/prosody-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to