Why keepAliveTimer

4 views
Skip to first unread message

Clive

unread,
Jan 20, 2010, 10:04:30 PM1/20/10
to Hemlock
Hemlock sends a space character to the server every 15 seconds, which
I am afraid would cause unnecessary overhead to the server if the
online users grow to thousands. However, I stopped the timer, and open
a hemlock app without any activity for about one hour, all works fine
when I came back to activity. So why keepAliveTimer?

Ron DeVera

unread,
Jan 26, 2010, 9:32:18 AM1/26/10
to Hemlock
Hi Clive,

This may be an issue with Ejabberd only (as opposed to other XMPP
servers), but we did specifically add this timer to solve problems
with idle disconnects. There may be an ejabberd.cfg setting that could
solve this issue as well. Failing that, pinging the server every 15
seconds could indeed be overkill, so we'll also explore lower
frequencies that might also work.

Hemlock powers one of our large multiplayer gaming sites, so we'll be
experimenting with the framework to reduce overhead like this. Feel
free to fork the project on GitHub (<http://github.com/mintdigital/
hemlock>), and let the group know if you find an optimal balance.

Cheers,
Ron

Clive

unread,
Jan 26, 2010, 8:28:36 PM1/26/10
to Hemlock
Thanks for the reply. Yes, I've actually branched Hemlock on GitHub
(http://github.com/linzhp/hemlock). On that branch, I stopped the
timer because my experiment showed that the connection still alive
after idling for about 1 hour. Admittedly, I haven't tested it on
production environment, maybe I should first set it to like 1 min, 5
min, 15 min, 1 hour... before totally disable it. In addition, I think
it would be better to resetKeepAliveTimer() every time you call
XMPPConnection::send(data:*), because when the application
communicates with ejabberd so frequently, it's not necessary to keep
alive with a blank string. However, I don't know how to do that
because XMPPConnection does not hold a reference to XMPPClient to all
resetKeepAliveTimer() on it.

What's more, my branch fixed a bug on ses...@conference.some_server/
nick_name, refactored HemlockContainer so that it does't need to be
the top Sprite of the application. The latter change is not trivial, I
hope you could kindly review my code and give suggestions.

Thanks again!

Clive

unread,
Jan 28, 2010, 4:21:08 AM1/28/10
to Hemlock
I realized some of my modifications to HemlockContainer was wrong and
revert part of them.

On Jan 27, 9:28 am, Clive <lin....@gmail.com> wrote:
> Thanks for the reply. Yes, I've actually branched Hemlock on GitHub
> (http://github.com/linzhp/hemlock). On that branch, I stopped the
> timer because my experiment showed that the connection still alive
> after idling for about 1 hour. Admittedly, I haven't tested it on
> production environment, maybe I should first set it to like 1 min, 5
> min, 15 min, 1 hour... before totally disable it. In addition, I think
> it would be better to resetKeepAliveTimer() every time you call
> XMPPConnection::send(data:*), because when the application
> communicates with ejabberd so frequently, it's not necessary to keep
> alive with a blank string. However, I don't know how to do that
> because XMPPConnection does not hold a reference to XMPPClient to all
> resetKeepAliveTimer() on it.
>

> What's more, my branch fixed a bug on sess...@conference.some_server/

Reply all
Reply to author
Forward
0 new messages