Improvements to mod_muc_room
ESL Developer Blog - - September 11, 2009Because I am currently in the process of coupling mod_muc to our web-application-server I need to bind mod_muc to the permission-system that we have online (that is rewriting of mod_muc_room:get_affiliation/2 and :get_role/2.
During testing of the functionality i found, that these to functions are being called VERY often. I further looked into the case and found some instances where these functions are being called before passing some rather trivial checks (like whether the room is public or not). This was rather nasty because fetching a list of a few hundred rooms and then asking the role and affiliation for each room NINE times is pretty harsh on the web servers.
So I shifted some code around and was able to reduce the number of calls to these functions (for the “disco”-case) to TWO.
i stripped the code of all other modifications and it is included as an attachment to this post. Since i guess it is relevant how often you call the database with mnesia as well, I thought I’d share it. Code is “untested”, serves my purpose and should not be very error-prone, since it is basically just a refactoring of the functions handle_sync_event and process_iq_disco_items.
Get it here: mod_muc_room
Categories: Blogs ESL Developer Blog
Comments
No comments so far, you could be the first.Add comment
Erlang on Twitter
» wjlroe (Will Roe): #erlang #otp in action on my #kindle, yeah! http://twitpic.com/2my7vh
» jianzwang (Jianzhi Wang): erlang/mnesia/CAP/Two-phase commit都是需要安静下来仔细琢磨的东西,一旦决定使用,将会面临极大的风险
» fprogblogs (ФП-Блоги): dmzlj пишет: необъяснимое про erlang http://bit.ly/bWR1bK
» fprogblogs (ФП-Блоги): Dmitrii ‘Mamut’ Dimandt пишет: Flymake и Erlang http://bit.ly/cbaWMs
» sbtourist (Sergio Bossa): @dnene +1 for Clojure and/or Erlang :)
» delegatevoid (Timothy Parez): @TheColonial I’ll keep an eye on it… ever never seen anything about erlang before… only mentions from you
» pjimmy (Jimmy P): @TheColonial lol I thought you were just mad at your erlang install..
» TheColonial (OJ): @delegatevoid It’s me, trying to get a regular podcast up for erlang related stuff. Been on the backburner though.
» williamgouvea (William Gouvea): RT @dnene: My now publicly stated goal is to be competent at atleast 1 FP language (out of Scala / Clojure / Haskell / Erlang) by the year end
» williamgouvea (William Gouvea): RT @dnene: Preliminary learning for Scale, Clojure done, Haskell in progress, Erlang in queue
Statistics
Number of aggregated posts: 10084
Number of comments: 564
Most recent article: September 07, 2010
Latest comments
» Simon cadbury on CouchDB Load Balancing and Replication using HAProxy.: Very nice Site number one topic Thanks you.. [url=“http://www.designscopia.com/products/outdoor-media/mobile-ads.asp”]mobile ads design [/url] | [url=“http://www.designscopia.com/products/print-material/stickers.asp”]stickers design [/url]
» dress on Reading Serialized PHP Objects from Erlang: canon lens mugs Nikon Mugs Canon Coffee Lens Mug Nikon Coffee Lens Mug anon coffee mug,canon lens mug,canon mug,canon coffee…
» dress on Fun with processes (Updated): canon lens mugs Nikon Mugs Canon Coffee Lens Mug Nikon Coffee Lens Mug anon coffee mug,canon lens mug,canon mug,canon coffee…