Private chat with Prosody

432 views
Skip to first unread message

jette

unread,
Jun 14, 2011, 11:19:36 AM6/14/11
to Prosody IM Users
Hi

I am new to XMPP and Prosody. I've been looking at various XMMP-
servers today, but some of the projects are dead, others have a large
footprint, and one did not have any documentation at all.
I have burned my fingers on a comet server project that went dead with
a serious performance bug, and I've been told that XMPP is the way to
go.

To start with, I would like to have confirmed that Prosody is suitable
for my needs.

I have a website with 20.000+ registered users. At any given point we
have between 300 and 1000 users online, and 0 to 100 of them are
chatting.
We need a web based client for user-to-user private chats. No rooms
and no conferences, only private chat. It also has to be limited in
access based on payment, blockings and such.

I guess I can handle the access limitations by sending messages
through and ajax call to a php script.

But how do you integrate with an existing website with database based
user accounts?
How many online users can one Prosody server handle? Is the software
stress tested?
How well does Prosody scale?
How does private chats work? Is there a user-to-user messaging
protocol, or do I need to create a room for each conversation?

Thanks a lot for answering my questions :-)

/Jette Derriche

Matthew Wild

unread,
Jun 14, 2011, 11:57:41 AM6/14/11
to prosod...@googlegroups.com
Hi Jette,

On 14 June 2011 16:19, jette <derr...@gmail.com> wrote:
> Hi
>
> I am new to XMPP and Prosody. I've been looking at various XMMP-
> servers today, but some of the projects are dead, others have a large
> footprint, and one did not have any documentation at all.
> I have burned my fingers on a comet server project that went dead with
> a serious performance bug, and I've been told that XMPP is the way to
> go.
>

It sounds like it possibly is, yes.

> To start with, I would like to have confirmed that Prosody is suitable
> for my needs.
>
> I have a website with 20.000+ registered users. At any given point we
> have between 300 and 1000 users online, and 0 to 100 of them are
> chatting.

Thanks for the (realistic!) figures, you don't know how many people
ask me all the time the same questions you are, without being able to
tell me what their usage is like.

> We need a web based client for user-to-user private chats. No rooms
> and no conferences, only private chat. It also has to be limited in
> access based on payment, blockings and such.
>

Ok.

> I guess I can handle the access limitations by sending messages
> through and ajax call to a php script.
>

How are the users authenticated/authorized currently? Generally if
possible it's nice to take care of things like this as a small
server-side module that implements restrictions, making the client
simpler, and the system in general more secure.

> But how do you integrate with an existing website with database based
> user accounts?

From 0.8 we support pluggable authentication backends, one for example
is mod_auth_sql (currently not bundled with Prosody, as it's not yet
feature-complete enough). This allows authentication against an
existing SQL database. Other backends are around, and they're not hard
to write.

> How many online users can one Prosody server handle? Is the software
> stress tested?

Yes, we test Prosody whenever we can, and especially when considering
changes that could potentially affect performance. We do not publish
benchmarks, for reasons I've probably been into on this list already.

How many users Prosody can handle is a function of how much RAM each
user requires, and how much RAM your server has. How much RAM each
user requires depends on exactly what the users are doing, whether
they have rosters (contact lists), and how large they are, as well as
a number of less obvious configuration/deployment choices.

For a decent dedicated server (say, a few GB RAM to be comfortable),
you should easily be able to reach 1000 users (making sure you use the
libevent connection backend). It doesn't sound like you'll be needing
server-to-server connections, which lessens the load.

> How well does Prosody scale?

The term 'scale' can mean so many things :)

If you mean how well can Prosody deal with users and load, fairly
well, though benchmarks reflecting your particular use-case are of
course recommended for a critical service. We'd be happy to help
develop/test those benchmarks when we can.

If you mean scaling across multiple machines, as some might, that's a
more in-depth question. Scaling XMPP this way certainly isn't as
trivial as scaling HTTP with load-balancers, etc. On the other hand,
there are some use-cases where it is actually possible to just run
multiple separate Prosody instances, and load-balance on the client
side.

Alternatively, our ultimate goal is clustering support for Prosody.
This is well established on the roadmap, but work (other than
planning) has not really begun yet. I'm hoping to have more news on
this late summer-autumn time (I'm [currently] in the UK by the way :)
). Clustering allows you to just add/remove Prosody instances as you
wish and Prosody handles the most of the scaling work for you.

> How does private chats work? Is there a user-to-user messaging
> protocol, or do I need to create a room for each conversation?
>

No need to create a room, at a minimum you can simply send:

<message to='othe...@yourdomain.com'><body>Hello world</body></message>

Prosody routes this directly to the other user (optionally storing it
if they are offline at the time).

> Thanks a lot for answering my questions :-)

Any time :)

Regards,
Matthew

Jette Derriche

unread,
Jun 15, 2011, 3:42:10 AM6/15/11
to prosod...@googlegroups.com
On Tue, 2011-06-14 at 16:57 +0100, Matthew Wild wrote:
> From 0.8 we support pluggable authentication backends, one for example
> is mod_auth_sql (currently not bundled with Prosody, as it's not yet
> feature-complete enough). This allows authentication against an
> existing SQL database. Other backends are around, and they're not hard
> to write.

Users are authenticated against a mysql database. So I guess I need that
sql plugin. What do you mean by "they're not hard to write"? I am just a
FAMP programmer, and I have absolutely no idea how to write stuff in lua
- I didn't even know this language existed until today :-)

I have been looking at ejabberd since it provides SQL, but it has some
nasty dependencies like Java and X11 (urgh!)

> Alternatively, our ultimate goal is clustering support for Prosody.
> This is well established on the roadmap, but work (other than
> planning) has not really begun yet. I'm hoping to have more news on
> this late summer-autumn time (I'm [currently] in the UK by the way :)
> ). Clustering allows you to just add/remove Prosody instances as you
> wish and Prosody handles the most of the scaling work for you.
>

Sounds good - I will not need it for a few years ahead anyway :-)

> > How does private chats work? Is there a user-to-user messaging
> > protocol, or do I need to create a room for each conversation?
> >
>
> No need to create a room, at a minimum you can simply send:
>
> <message to='othe...@yourdomain.com'><body>Hello world</body></message>
>
> Prosody routes this directly to the other user (optionally storing it
> if they are offline at the time).
>

Cool...

> > Thanks a lot for answering my questions :-)
>
> Any time :)
>

:-D

/Jette


viq

unread,
Jun 15, 2011, 9:18:27 AM6/15/11
to prosod...@googlegroups.com
On Wed, Jun 15, 2011 at 9:42 AM, Jette Derriche <j...@nerdgirl.dk> wrote:
> Users are authenticated against a mysql database. So I guess I need that
> sql plugin. What do you mean by "they're not hard to write"? I am just a
> FAMP programmer, and I have absolutely no idea how to write stuff in lua
> - I didn't even know this language existed until today :-)
>
> I have been looking at ejabberd since it provides SQL, but it has some
> nasty dependencies like Java and X11 (urgh!)

Sounds like you're on FreeBSD, have a look at the erlang-lite port, it
does not have those dependencies and is enough for ejabberd, if you
want to play with it.

> /Jette

--
viq

Jette Derriche

unread,
Jun 15, 2011, 9:53:56 AM6/15/11
to prosod...@googlegroups.com

Yes you are right... I just got an email from a friend also using
FreeBSD, and he told me how to install ejabberd without Java and X11 :-)

Thanks a lot - I think I'll give ejabberd a try and see how well it
works.

/Jette

Matthew Wild

unread,
Jun 15, 2011, 9:56:50 AM6/15/11
to prosod...@googlegroups.com
On 15 June 2011 08:42, Jette Derriche <j...@nerdgirl.dk> wrote:
> On Tue, 2011-06-14 at 16:57 +0100, Matthew Wild wrote:
>> From 0.8 we support pluggable authentication backends, one for example
>> is mod_auth_sql (currently not bundled with Prosody, as it's not yet
>> feature-complete enough). This allows authentication against an
>> existing SQL database. Other backends are around, and they're not hard
>> to write.
>
> Users are authenticated against a mysql database. So I guess I need that
> sql plugin.

http://code.google.com/p/prosody-modules/wiki/mod_auth_sql
http://prosody-modules.googlecode.com/hg/mod_auth_sql/mod_auth_sql.lua

> What do you mean by "they're not hard to write"? I am just a
> FAMP programmer, and I have absolutely no idea how to write stuff in lua
> - I didn't even know this language existed until today :-)
>

Oh, I was just making a point - lots of people have lots of weird
stuff they want to auth against, SQL is probably the most common
though :)

An example of a custom backend would be authing directly against some
web app, which is possible (though I'd still go direct to the DB if
you can, to avoid the additional overhead).

Regards,
Matthew

Reply all
Reply to author
Forward
0 new messages