[ejabberd] Question related to pubsub avatars and HTTP access
Teemu Harju
teemu.harju at gmail.com
Wed Jan 9 20:32:49 MSK 2008
Hi,
I found this bug when Googling...
https://support.process-one.net/browse/EJAB-333
So tried to use http_base_64:decode() instead of jlib:decode_base64() and it
works a lot better. jlib decoder takes around 30 seconds to decode the image
while the http_base_64 decoder does it in much less than half a second.
These experiments were done on my home server (Celeron 700MHz). Probably the
difference is smaller with faster machine...
Anyways, I haven't tried the http_base_64 decoder yet with ejabberd, but
according to the bug report it might crash it. :( Any ideas on how to
improve the performance of jlib base64 decoder?
Regards,
- Teemu
On Jan 8, 2008 8:05 PM, Badlop <badlop at gmail.com> wrote:
> 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.
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
--
Teemu Harju
email/jabber: teemu.harju at gmail.com
blog: http://www.teemuharju.net
~~ "A computer is like air conditioning: it becomes useless when you open
windows." ~~
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jabber.ru/pipermail/ejabberd/attachments/20080109/a9de71e2/attachment-0001.htm
More information about the ejabberd
mailing list