plot 0 Report post Posted September 30, 2005 By itself, IPB is relatively easy on the server load, considering the cool stuff it does. But when you start adding a bunch of mods to your site you may start to see the pages taking longer and longer to load, until eventually people won't come to your site anymore because the pages never finish loading. This topic is for both mod makers, and forum owners looking to install mods or skins on their site.1. Control the query count. This is the most important mistake new modders make and release in their mods. You want to limit the number of queries you do as much as possible. Queries take processing power, and with a large database this means page loading time. If you find that in order to make your mod you have to code it to run several queries on every page load you are going to have a poorly performing mod. I installed a mod for a friend not too long ago that was coded to use 4 queries just to find out one piece of data. That is so inefficient and really quite negligent that it's not even laughable. I rewrote the code for this mod for my friend. So if you are a forum owner, take the time to go through the code if it is a small mod and see how many times it does $DB-> commands. If you see it doing this an awful lot, this should throw up a red flag; check the mod's support topic to see if anyone had problems with it.So what do you do if you're a mod writer and you need to get your data? Try using the cache, in IPB 2.0 there is a built-in cache system that will store important data for you. This does add some page load time to the board because of the memory requirements for this cache, but it's easier on your server than querying. You can even do a kind of cache in IPB 1.3, I did it for one of my mods. Also consider using LEFT JOIN commands to link multiple tables together in a query. You should never run one query to get one piece of data, then immediately use that same data to run another query.2. Keep your code neat & tidy. Check out IPB's source code, it is very well organized and efficient. Most functions start off the same way, by doing error/permission checking. Do this part right away because you can save server load by doing it first. If you deny someone access to a part of your mod, then the code that would have to run to generate that part of the mod will never run.If you are a forum owner, the best thing to look for in the mods you install is that the code has a definite structure. You should see the code indented properly, curly brackets used correctly, comments where needed, efficient 'if' statements, etc. Seeing that the modder has taken the time to write their code in this manner typically shows that they really know what they are doing. The code is much more likely to be efficient on your board's resources. The IPB source code should be your yardstick here: if you can plug the mod's code right in and not even tell it's there, it's probably a well-coded mod.3. Query for only what you need. Yes, it may be tempting to just use the "SELECT * FROM..." in your queries, and while developing this is typically acceptable. But when you get your mod finished up you need to make sure the queries pull only the data you need. If the table has 8 columns, and you only need 4 of them for this section of the mod, then pulling those 4 columns will take up half as much server load. So look through your code and see which fields you use later on in either the source or the skin, and adjust your queries to just pull those.As a forum owner, take a look through their code and see if they are doing any "SELECT * FROM..." queries. While this isn't something that you will immediately discard the mod over, it should be noted that this mod is probably not going to be as easy on your server as it could (and should) be. This becomes very important on larger, more popular boards.These are a few of the big points, but there are certainly others. Feel free to share your own tricks, or ask any questions about these. Share this post Link to post Share on other sites