mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <elecha...@gmail.com>
Subject [MINA3] Idle processing
Date Fri, 22 Mar 2013 16:54:51 GMT

as I'm implementing the UDP server, and got really low performances
compared to the same test done on MINA2, I did some profiling. It
appears that the idle processing is a bit of a bootleneck, the way it's
currently implemented.

For instance, we grab the WRITE_IDLE_INDEX from the session attributes,
and update it :

    public void sessionWritten(final AbstractIoSession session, final
long timeInMs) {
        final Integer oldIndex = session.getAttribute(WRITE_IDLE_INDEX);
        session.setAttribute(WRITE_IDLE_INDEX, index);

Accessing the WRITE_IDLE_INDEX attribute is done with this method :

    public final <T> T getAttribute(final AttributeKey<T> key) {
        return attributes.getAttribute(key);

which calls :

    public <T> T getAttribute(AttributeKey<T> key) {
        assertNotNull(key, "key");

        try {
            T value = (T) attributes.get(key);

            return value;
        } finally {

So far, so good, except that we acquire a lock and release it for every

Wouldn't it be better to store the WRITE_IDLE_INDEX as an AtomicLong in
the session itself ?

Emmanuel L├ęcharny

View raw message