[ejabberd] Question related to pubsub avatars and HTTP access

Badlop badlop at gmail.com
Tue Jan 8 21:05:49 MSK 2008


2008/1/8, Teemu Harju <teemu.harju at gmail.com>:
> sends this over HTTP to a web browser. Now the problem is that this is
> extremely slow. It takes around 30 seconds to get the image loaded. Its
> 96x96 15.9 kB png image. That shouldn't  take that long. Here is somewhat in
> more detail what I do...
>
> This is how I get the avatar data... I used Psi as a client to publish the
> avatar image.
>
> get_avatar_data(ItemId) ->
>     F = fun() ->
>                 Q = qlc:q([Item#pubsub_item.payload || Item <-
> mnesia:table(pubsub_item),
>
> Item#pubsub_item.itemid == ItemId]),
>                 qlc:e(Q)
>         end,
>     {atomic, [[_, XMLData, _]]} = mnesia:transaction(F),
>     jlib:decode_base64(xml:get_tag_cdata(XMLData)).


In the ejabberd chatroom he tried this code:

get_avatar_data(ItemId) ->
    F = fun() ->
                Q = qlc:q([Item#pubsub_item.payload || Item <-
mnesia:table(pubsub_item),

Item#pubsub_item.itemid == ItemId]),
                qlc:e(Q)
        end,
    ?INFO_MSG("Starting QLC"),
    {atomic, [[_, XMLData, _]]} = mnesia:transaction(F),
    ?INFO_MSG("Finished QLC, Starting base64"),
    Res = jlib:decode_base64(xml:get_tag_cdata(XMLData)),
    ?INFO_MSG("Finished base64"),
    Res.

And this is the result:
=INFO REPORT==== 8-Jan-2008::19:50:49 ===
I(<0.340.0>:mod_http_pubsub:60) : Starting QLC

=INFO REPORT==== 8-Jan-2008::19:50:49 ===
I(<0.340.0>:mod_http_pubsub:62) : Finished QLC Starting Base64 decode

=INFO REPORT==== 8-Jan-2008::19:51:18 ===
I(<0.340.0>:mod_http_pubsub:64) : Finished Base64


So that confirms the delay of 30 seconds is caused by jlib:decode_base64.


More information about the ejabberd mailing list