Hi,
I'm running ejabberd on my server and it works ok.
I've built a script with JAXL (PHP) and I'm having slowness that require the script to be restarted every hour.
I don't know whether it's due to ejabberd or JAXL or my script, but I've put logs and I didn't find any bottlenecks neither in JAXL nor in my own script. But it's not 100% sure, of course.
But let me explain what this script does :
- ejabberd is used as a chat service inside an MMO game
- I've got a pseudo-user, let's name it "bot-user"
- This "bot-user" is the user that is used by the script, it's the script user.
- Each and every real user is created in ejabberd during the process of character creation in the game. All this works perfectly
- Whenever a player connects to the game he (the game app) also connects to ejabberd using his login/pwd. All this works perfectly too
- Each ejabberd real player account is added a single buddy that is my "bot-user", so everyone can speak to and only to "bot-user". This "bot-user" will then be a kind of router for all messages. He will receive messages (with special formatting) and re-route them to the right real players
- At this point, this scheme is playing well with over 180 simultaneous people and over 30.000 accounts created and counting.
- I'm now reaching the issue I get constantly: The script starts becoming slower and slower to a point that needs it to be restarted. I do so every hour so it doesn't become too slow.
- And also when messages arrive, they seems to arrive (on the players screens) in a bunch, 3-4 at the same time.
- I thought this was an issue with JAXL but my research didn't point out any bug or bottleneck or memory hogs. I'm not a jabberd specialist and I'm not sure whether this is or not a ejabberd issue. I set shapers like this :
. {shaper, mmo1, {maxrate, 256000}}
. {access, c2s_shaper, [{none, admin}, {mmo1, all}]}
- I didn't find any param that would limit a user (my "bot-user") to send more than X messages in a given period. I just found a limit in bandwidth. Btw, "bot-user" is counted in the "all" users in the above "access" rule, right?
- The issue seems to be tied to my "bot-user" account as when I, as a player, send a message from within the game app, I can see it immediately received in the script and re-routed. It's just the re-routed messages than can take a while to be distributed (I don't mean "submitted" to ejabberd, I said "distributed") to target players.
- Note also that it doesn't seem to be an issue with the number of players at a given time as when I restart the script they are still all connected and the script starts re-routing full speed to all of them.
- One last point, messages are short (160 chars max, 200 chars max with some params encapsulation), we should be way lower than the 256.000 bytes / second shaper limit. And I've got a 20Mbps bandwidth.
I hope someone can share some experience or point me to params that I would have missed...
Thanks for your help
Btw, if someone is interested by my experience building a chat service in a game like this MMO, I'd be glad to share.
--Gildas Q.
Big Papoo wrote: I set
I set shapers like this :
. {shaper, mmo1, {maxrate, 256000}}
. {access, c2s_shaper, [{none, admin}, {mmo1, all}]}
- I didn't find any param that would limit a user (my "bot-user") to send more than X messages in a given period. I just found a limit in bandwidth. Btw, "bot-user" is counted in the "all" users in the above "access" rule, right?
Yes, that config should allow all users except admins to have a maxrate of 256000.
You can add a few more zeros to that integer in ejabberd.cfg, just to check if that helps.
Or don't provide the shaper option in ejabberd_c2s listener at all, so no shaper is applied.
Probably unrelated, but you can try to disable mod_privacy and other modules that
I've built a script with JAXL (PHP) and I'm having slowness that require the script to be restarted every hour.
- I'm now reaching the issue I get constantly: The script starts becoming slower and slower to a point that needs it to be restarted. I do so every hour so it doesn't become too slow.
- And also when messages arrive, they seems to arrive (on the players screens) in a bunch, 3-4 at the same time.
when I restart the script they are still all connected and the script starts re-routing full speed to all of them.
Maybe the erlang process that manages the bot xmpp session inside ejabberd gets a huge queue, because for some reason it can't route stanzas as fast as the script sends them.
Eper includes a program called Dtop, which is similar to Top but for processes inside the erlang virtual machine:
https://github.com/massemanet/eper
Thanks, I will investigate
Thanks, I will investigate that way and keep you inform if I find my problem.