Posts filed under: PHP
Back from Brussels
So I’m back in San Francisco after returning from Brussels and one insane week packed with conferences. (EuroOSCON, GovCamp, DrupalCon, and BarCampBrussels). I’m exhausted, but buzzing with excitement. There are just too many people doing interesting things in this world.
Next up: San Fran Drupaler’s should unite and throw something serious down at the upcoming Yahoo! Hack Day. I’d like to go, so if there are other Drupal heads in attendance, I’d love to work on any kind of hack involving Drupal, Yahoo! maps, upcoming.org concert data, and last.fm. Send me a shout if you’re interested!
Speeding up XML-RPC calls in Drupal
Through Bryght, I’ve been working on an interesting project that really exercises the “toolkit” and “web services platform” like nature of Drupal. The final architecture of our project ended up having many distributed processes, all sending data to Drupal through XML-RPC, and we were using Drupal mainly to aggregate and display the results.
Performance was very important, and we were having a huge bottle neck with Drupal’s XML-RPC library. XML-RPC calls were talking a long fricken time, and we were making tons of them.
Fortunately I had help from Walkah and Moshe, and I thought I would pass on what we did to drastically increase XML-RPC performance. This worked for us, so maybe it might help someone else out.
The problem is of course that Drupal does a full bootstrap for every XML-RPC call.
Our solution:
The first, simple (and huge) win was to utilize a PHP opcode cacher - this drastically reduces this bootstrapping time. We used eAccelerator, but there are many others.
Secondly, since we were working in a controlled environment (we knew what modules were going to be called via XML-RPC) we were able to hack the xmlrpc.php file to avoid a full bootstrap. The downside is we had to hardcode a few path things into the file, but again, this is for a particular app/site, and the performance gains were worth it.
Courtesy of Moshe, here is our revised xmlrpc.php file (you might want to rename it to xmlrpcs.php or something):
< ?php
// $Id$
/**
* @file
* Optimized php page for handling xml-rpc requests. Your module must use declare the hook_init() or hook_exit()
* so that it is loaded during the boostrap. Otherise, use hook_xmlrpc as usual. Note that only required modules are loaded at this point.
*
* @author
* Moshe Weitzman
*/
// CONFIGURE
$path = ‘./sites/mwpb-9.local/modules/’;
$module = ‘my-xmlrpc-module’; //the name of the module where your xml-rpc calls are
// END CONFIGURE
include_once ‘./includes/bootstrap.inc’;
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
include_once ‘./includes/xmlrpc.inc’;
include_once ‘./includes/xmlrpcs.inc’;
require_once $path. $module. ‘.module’;
$function = $module. ‘_xmlrpc’;
$callbacks = $function();
// print_r($callbacks);
xmlrpc_server($callbacks);
// put any common.inc or other core functions here that your module relies upon.
function t($string) {
return $string;
}
?>
This was enough to get a huge increase in performance. (Yeah!)
Further thoughts:
One could use “mysql_query()” and avoid bootstrap all together, although I don’t think this is very much overhead, and the benefits of using Drupal’s “Database abstraction layer” probably out way any performance overhead here.
I wonder if there is any way to get Drupal to intelligently load necessary code instead of doing a full bootstrap. The “hardcoding” method above certainly works, but I am craving a more elegant and universal solution. Any thoughts?
Playlist module released
Over the last little while I’ve been working on a playlist module for Drupal. Farsheed was also working on a playlist module. So we have combined forces and now present to you the fruit of our labours: The new, improved, ass kicking playlist module.
Features include:
- support for mulitple playlist formats, including xspf, m3u, pls
- podcastable playlists
- AJAX ordering of audio tracks
- multiple ways to add an audio track to a playlist
- For the geeks in the crowd, playlists are implemented as a new node type.
Farsheed has set up a nice demo site where you can go and kick tires a bit, but you have to sign up first to create your own playlists. Enjoy!
Podcasting and the post-album world
Fellow Vancouverite Tim Bray has an interesting post about podcasting and the economic impact it will have on musicians. I agree with just about everything he says. Which is good, since the same ideas he discusses form the impetus for Bryght’s new musician focused web platform.
Tim suggests a subscription based podcast service, and this is one type of revenue generating solution Bryght plans to offer to musicians. I’ve said this before, but based on my own informal surveys, I think there are many musicians out there who might want to be free from the constraints of the album. As an artist, why not just release and sell a few tracks a month, delivered straight to your fans MP3 player through Podcasts?
One could argue that the very concept of the “album” is arbitrary and is simply an artifact of our current (and physical) distribution channels. In the past, an album has been a convenient way to get music to the people. Stores stocked high selling albums, due to limited shelf space. People came and bought them. But now, we are at an interesting time. Digital distribution channels have matured to the point where they will start to influence the art that people produce and consume. Music distribution technology influencing music? That’s right, it’s a two way street!
For example, the phonograph and radio drastically influenced the music that was produced, simply by creating new markets. Would 80’s rock bands have worn as much makeup if their faces weren’t being beamed via MTV to millions of homes?
Looking ahead, I think a post-album future filled with regular releases of individual tracks will be more then simply a sea of singles, and I can’t wait to find out what takes shape.
– Update –
Richard chimes in with some good thoughts
Mambo developers stick a fork in it
It is being reported in a few different places that the core developers for Mambo have split from Miro, the commercial entity that holds the Mambo copyright and trademark. The problems stem from how Miro set up the Mambo Foundation, particularily how they failed to consult many of the main developers.
In response, it seems that the Mambo development team is going to fork the open source project and go forth on their own, which certainly puts many members of the Mambo community in a tight spot.
Most important though, is what will the new forked project be called? My vote is for Lambada, all though Meringue also has a nice ring to it.
Lessons for the Drupal community? Greed sucks, be open and transparent (especially when setting up a foundation), and play nice with others!
Ticket Master wins again
I just purchased 4 tickets to see Sigur Ros in Vancouver at the Orpheum. I fully expected to be gouged by the usual service charges, but even so, I was impressed with the audacity of Ticket Master.
Face Value of Actual Ticket - $35.00
Facility Charge - $1.75
Convenience Charge - $5.00
Processing Fee - $2.25
For four $35 tickets, one might expect to pay around 4 X $35 = $140, but when all the charges add up, I was billed $169.25! Before tax!
What we need is an open source, Drupal based, Bryght hosted, concert ticketing solution.
Audio Module released
At Bryght, I have the enviable job of customizing Drupal for use on recording artists and record label web sites. One of the first things I wanted to do was to beef up audio support in Drupal, and so last week I was able to release the first version of the audio module. It can read and write ID3 tag information, can stream and download audio, and generates proper podcast-safe RSS enclosures. I am still working on adding support for iTunes RSS extensions, and cleaning up the code a bit, but it is working well on my site. Hopefully it will help others out there as well!
Blink Sale
I love the new basecamp-ish look of the blinksale accounting program. As a freelancer, I am horrible at keeping my billing straight, and this online application looks like a fantastic solution. The invoices are sharp and stylish, the interface is filled with AJAX goodness, iCal and RSS integration; What’s not to like?!
It seems like there are now a number of web applications whose feature set and usability levels rival (and surpass) those of their desktop competitors. I actually prefer the Gmail interface to that of many desktop email clients, and from my brief look at blinksale, it seems to be easier to use then many desktop accounting programs. Exciting times for web development!
Update:
So I have tried to automate my billing with blinksale this month, and have been unsuccessful. There was no place for me to enter my GST number, or any other additional fields that I required. Maybe I have to upgrade to the non-free account to accomplish this, but at this point I have lost my enthusiasm. Sigh… Back to Excel templates.
DrupalART website launched
DrupalART has been recently launched. What are they about?
DrupalART is a site dedicated to helping people build and develop Drupal sites for artists and musicians. The goals are to show (through examples) various ways Drupal can be used to build artist websites, and build documentation aimed at newbies trying to use Drupal for their art or music website.
To start with, Farsheed has put up a good tutorial on how to podcast with Drupal. This site looks like it will be a great resource for artists and musicians.