Jay Pipes is the Community Relations Manager for North America at MySQL. He joined MySQL in January, 2006, and is co-author of Pro MySQL (Apress, 2005). Frequently speaking at conferences about MySQL, Jay lives in Columbus, Ohio, with his wife Julie, and his extremely needy two cats and two dogs.
Although I've been a tad absent from the MySQL Forums for a couple months, I have spent many hours answering forum posts over the last year. The MySQL forums have grown substantially over the last year, and Phorum, the PHP software running the MySQL Forums, has kept pace with this growth admirably. Likely, this is due to the fact that Brian Moon designed Phorum to focus on performance first. If you've spent any amount of time on the forums, you probably will have recognized Brian among the forum users who most frequently answer posts -- particularly SQL and performance-related questions. Some time ago, I had a chance to ask Brian a little bit about his experience writing Phorum, about his thoughts on open source and MySQL in particular, and on his vision for Phorum in the future. |
Jay: What's your background in software? Did you go to school specifically to become a software developer?
Brian: No. I started college as a math major. I did not do so good at the typical 4-year institution. I came back home after a year and attended community college at night. I taught myself FoxPro, Visual Basic and eventually PHP among others. I took classes on C and C++ at college. I had been using BASIC since I was 10 though. My Dad brought home a Commodore VIC-20. So, programming was not new to me in college. My knack for developing got me jobs and the rest is history.
Jay: When did you first start working on Phorum, and what were the motivations behind it?
Brian: The company I presently work for, dealnews.com, like most cool .com companies was started in the spare time of several people. I was one of those people. We needed a forum and we had specific needs and wants. We tried adapting WWWBoard (the hot forum of the time), but, it was too big of a modification. So, one day, I hacked together thee scripts that did the basics of what we needed. I posted to the PHP list for help testing. Within a month, we had version 1.0 of Phorum. As far as I know, Phorum was the first PHP/MySQL based message board. It was released in April of 1998.
Jay: As a developer, I understand that sometimes features come at the expense of performance. How do you go about deciding which features make it into Phorum, and where to draw the line with feature requests?
Brian: That is a good question. There are core things obviously like just reading and posting messages. The main place we focus our performance attention is 4 places really. The forum list, the message list, the read page and the posting process. My research has shown that 75% of forum traffic is on the read page. Another 20% is on the message list page. So, we focus hardest on those. Our module system allows us the freedom to not include some things in the core application. If a feature is crucial to the application, we will do our best to work it in. Counting views is a good example. This is a horribly expensive task. It will double your database queries. But, to be a modern forum, you have to have the option. And that is why you can turn it off. The features we can't make into modules that may impact performance can usually be disabled. Another example is tracking user usage for use in modules like the Who's Online module. Updating the db on every page request with a timestamp is IMO, horrible use of resources. So, we made it configurable so that it would not spam your database. Also, we would not add a feature like that to the core without a core need. In that case, admins wanted to know what users that had not been active for a while. The default setting is to only update their activity once per day.
Jay: As you know, MySQL 5 brought an enormous number of features to the MySQL server codebase. Do you plan to have a version of Phorum that uses stored procedures, triggers, and other MySQL 5 features?
Brian: With Phorum's unique database layer, we could make a MySQL 5 specific layer. We do things a little different. We have created a system where all interaction with storage is contained. That allows us to use FullText searches with MySQL and not have it be hardwired into the Phorum core. In theory, you could write an XML storage system for Phorum. The core code does not care. However, to date, no one has really stepped up to write for other systems. We do have a mysqli layer for those using the mysqli with PHP. But, it is really just a port of the mysql layer. We are moving to MySQL 5 at dealnews.com soon, so once I get my hands on it on a daily basis, I can start to see how it could apply to Phorum. The main thing that excites me about Mysql 5 (5.1?) is the multiple key usage with OR and IN clauses. That will help Phorum a lot. We use IN clauses everywhere.
Jay: What lessons have you learned about PHP and MySQL development by working on Phorum? Are there any specific PHP performance tips you'd like to share with the user community?
Brian: I would say that 75% of what I know about PHP and MySQL has come from working on Phorum. As the other Phorum devs will tell you, I love to benchmark stuff. Here are some of my personal opinions on writing fast PHP code:
Jay: I had noticed that Phorum uses a homegrown compiled template solution. What were your motivations for going with a homegrown solution over something else, like Smarty?
Brian: I started on the Phorum template system either before Smarty existed or before I knew about it. That said, I still would not use it. In fact, if it was up to me 100% and I was the only one using Phorum, I would use this great templating language called... PHP. We wrote the templating language to help users that were scared by the <?php ?>
. The key to our system is that we A) compile the templates into a PHP form and B) don't use a class every time we want to use a template. Our system simply includes the compiled template file inline. This makes it much faster. That also means that you can use PHP in the templates if you need/want to. Oh, a little secret, the function that gets the template file to include checks for a .php file before it checks for the .tpl file. You could skip the whole template language if you wanted.
Jay: What big things are on the horizon for Phorum? What are you most excited about?
Brian: I am redoing the default template right now. I am making a more modern default template. We got a huge pop when we redesigned our site to be less geeky and more professional. I am hoping to the get the same response by creating a visually appealing template as the default. We will still have a minimalist template like the current default too. Part of this is getting rid of some inconsistencies in the template language. Some files used ROWS and other MESSAGES for the same data. Stuff like that.
I also have Phorum 6 sprouting in the back of my mind. Its only a gleam in my eye right now. In fact, what I have in mind may not be Phorum 6 but a second application that is in its own class.
Jay: You develop Phorum, along with other developers, in your "free time". What do you do as a day job? What does your typical day entail?
Brian: Well, luckily as I stated above, Phorum is part of my day job. In fact, its how I got my day job. The offer made to me was "How would you like to work on Phorum full time?". Of course, that did not last forever. I am a developer and systems admin for dealnews.com. You can read all about us at http://dealnews.com/about/about.html. We have a small dev team of just 3 people. We are avid Open Source supporters.
One thing I like to point out is that the developers of Phorum use the application on very busy forums. I don't know that this is true in all PHP/MySQL open source applications. I know its not in some. We write it for ourselves first. Some may take that as a negative. Its not about us not supporting our users. Ask them. They will tell you we do. What it does mean is that you can feel confident someone cares about the code. It has to work. Our livelihoods depend on it.
I work from home some, so, my day varies. I usually get to the computer, check for any IMs that have come in. Our writers start much earlier than I do. Then I check email and the Phorum support forums. Then its off to whatever I am working on for dealnews. We are still small and growing so we move around a lot. Today's top priority could be number 5 on the list next week.
Jay: I hear that. I think that's something all software projects struggle with! Well, Brian, I want to sincerely thank you for your time and for answering our questions and also with providing a top-notch FOSS application that helps meet the very demanding needs of the MySQL forums. You guys rock.
Brian: Thanks, Jay!
This interview was performed on June 3rd, 2006 and followed up on August 29th, 2006