Migrated IPB to PostgreSQL and happy

43 posts in this topic

Posted

I currently have some ~4.5M posts, ~50K users and ~1000-1500 concurrent sessions depending on time of the day and have been experiencing significant performance problems with using MySQL on my forums.

Most if not all of the performance problems were caused by long queries that would lock table updates that in turn will lock all the subsequent selects. This is a known problem with table level locking in mysql. I have moved search to Sphinx, but this only addressed some of the problems.

One of the recommended ways on forums was to use MyISAM to avoid table locks, but it has got its own issues and also, you cannot do a hotbackup with free open source tools (you can backup from replication, but this is not the best choice in all scenarios). Another proposed solution was to redirect all long queries to replication slave, but this looked ugly to me.

So, I have decided to use beta-posgresql drivers from IPB 2.x to try to migrate to PostgreSQL. I have submitted a number of driver patches to IPS, made a number of modifications to the code, added few new indexes to tables, managed to complete a database conversion without losing any data, but after all I am now a happy user running IPB 2.x on PostgreSQL 8.3.

So far, so good. No more locks, no more long running queries. I still have some glitches to fix, mainly due to IPB code relying on some Mysql gotchas like implicit conversion of chars to integer etc., but by and large this was a successful upgrade, and this topic is to share the success and may be convince IPS to keep their work on PostgreSQL drivers :)

I was also wondering if anybody else has managed to migrate to PostgreSQL as well?

Share this post


Link to post
Share on other sites

Posted

I've been hearing a lot of good things about PostGreSQL myself, but I hear a lot of conflicting information, particularly over which RDBMS is the best solution, since both PostGreSQL and MySQL are open-source and freely available, unlike MS-SQL and Oracle.

One person told me, MySQL is closer to Standard-Compliant SQL, that PostGreSQL has a lot more "isms" that break's compatibility.
Another person has told me, that PostGreSQL is closer to the standard, and scales better.
Another, the project manager for a very popular bittorrent client, finds that MySQL scales badly and isnt multithreaded.
I have noticed that on any site that gains a reasonably large amount of traffic, MySQL buckles under the load on a single server, though that could easily be a result of running Apache with prefork, which is rather inefficient, especially on servers that have multiple CPU's.

Share this post


Link to post
Share on other sites

Posted

Realistically in my experience, the open source database engines just aren't up to the same level as your paid solutions. Oracle, while enterprise level, is intended more-so for a single always-open connection and really really dislikes many connections being opened and closed frequently. Apparently there is a lot more overhead in doing this with Oracle, and it prefers something akin to persistent connections in MySQL (though I'm not sure if that's possible or not via PHP). MSSQL scales very well and handles searching very well even on larger sites, but of course there's a bit of a cost going with a proper MSSQL setup.

There's gonna be trade-offs no matter which way you go.

Share this post


Link to post
Share on other sites

Posted

[quote name='Nime' date='09 February 2009 - 07:50 PM' timestamp='1234205408' post='1784643']
I currently have some ~4.5M posts, ~50K users and ~1000-1500 concurrent sessions depending on time of the day and have been experiencing significant performance problems with using MySQL on my forums.

Most if not all of the performance problems were caused by long queries that would lock table updates that in turn will lock all the subsequent selects. This is a known problem with table level locking in mysql. I have moved search to Sphinx, but this only addressed some of the problems.

One of the recommended ways on forums was to use InnoDB to avoid table locks, but it has got its own issues and also, you cannot do a hotbackup with free open source tools (you can backup from replication, but this is not the best choice in all scenarios). Another proposed solution was to redirect all long queries to replication slave, but this looked ugly to me.

So, I have decided to use beta-posgresql drivers from IPB 2.x to try to migrate to PostgreSQL. I have submitted a number of driver patches to IPS, made a number of modifications to the code, added few new indexes to tables, managed to complete a database conversion without losing any data, but after all I am now a happy user running IPB 2.x on PostgreSQL 8.3.

So far, so good. No more locks, no more long running queries. I still have some glitches to fix, mainly due to IPB code relying on some Mysql gotchas like implicit conversion of chars to integer etc., but by and large this was a successful upgrade, and this topic is to share the success and may be convince IPS to keep their work on PostgreSQL drivers :)

I was also wondering if anybody else has managed to migrate to PostgreSQL as well?


No we have not migrated to PostgreSQL although my system administrator is advising me to do so, as we experience the same problems as you did. Unfortunately, IPB stopped supporting PostgreSQL.

Did you - basically - add a PostgreSQL library to the database libraries of IPB?

Do you intend to share this PostgreSQL library, whether or not for free?

And will you update the library - to the extent necessary - for IPB 3.0?

Lots of questions so far... :)

Share this post


Link to post
Share on other sites

Posted

I was hoping to see some interest here, but I can now see why IPS stopped supporting PostgreSQL - almost no demand.

I had to make a number of tweaks to the code to make it efficient and fix mysql-specific queries and remove reliance on mysql gotchas. However, most of the functionality is covered by the driver, which was provided to me by IPS in beta-form and which I also had to update to make it work, since it was quite an early beta.

I am willing to share the drivers, but this is not the only change needed which makes it a bit more complicated. I hope IPB3.0 code will be cleaner and it would be possible to only change the driver, so, yes, once source code for 3.0 is available, I will start working on PostgreSQL drivers.

Share this post


Link to post
Share on other sites

Posted

That's the thing. While we've always thought it would be nice to have PostgreSQL driver, and with the abstraction we have it's entirely doable, there hasn't seemed to be any demand. It takes development time and support time to create/support such a thing, so if there isn't enough demand it's not really feasible.

Like you, I was hoping to see more people replying to this topic. ;)

ZackL likes this

Share this post


Link to post
Share on other sites

Posted

Could the PostgreSQL driver perhaps be made into a community project for IP.Board 3? I'd gladly spend some time working on it with Nime, I have an interest in seeing an actively maintained version of it.

Share this post


Link to post
Share on other sites

Posted

Hmmmmmmm.

Share this post


Link to post
Share on other sites

Posted

bfarber, do you think it may be a chicken and egg problem? :-) may be once you have drivers available publicly demand for it will appear... may be I am wrong though.

Anyway, I think it would be useful to you if the code outside of driver is mysql-independent (which it is not 100% now). Having drivers that are maintained even by community would significantly help achieving that. With the way you have abstracted your code it is not such a big effort anyway.

Share this post


Link to post
Share on other sites

Posted

[quote name='Matt' date='25 February 2009 - 06:13 PM' timestamp='1235581983' post='1786974']
Hmmmmmmm.

:o

Share this post


Link to post
Share on other sites

Posted

I would consider switching to PostgreSQL if support for IPB matured and there were obvious performance benefits in doing so. :)

..Al

Share this post


Link to post
Share on other sites

Posted

[quote name='AtariAge' date='25 February 2009 - 02:51 PM' timestamp='1235595095' post='1787080']
I would consider switching to PostgreSQL if support for IPB matured and there were obvious performance benefits in doing so. :)

..Al


So would I. I actually have thought about it and I think what may be holding me back is the lack of support by modification authors. I think it could very well be a chicken and egg problem...

Share this post


Link to post
Share on other sites

Posted

[quote name='CynicalFrost' date='25 February 2009 - 04:12 PM' timestamp='1235596361' post='1787091']
So would I. I actually have thought about it and I think what may be holding me back is the lack of support by modification authors. I think it could very well be a chicken and egg problem...

If there is a database driver, and mod authors would stick to using the driver methods, then it shouldn't be an issue. I think nearly all are avoiding query() now, aren't they?

Marcher Technologies and ZackL like this

Share this post


Link to post
Share on other sites

Posted

[quote name='Μichael' date='25 February 2009 - 03:25 PM' timestamp='1235597106' post='1787095']
If there is a database driver, and mod authors would stick to using the driver methods, then it shouldn't be an issue. I think nearly all are avoiding query() now, aren't they?


I think so. I just remember that on IPB 2.x, the Universal Mod Installer was only supported for use on MySQL. Granted, the Universal Mod Install is now built in so that issue might be moot now.

Share this post


Link to post
Share on other sites

Posted

[quote name='Dan C' date='25 February 2009 - 03:33 PM' timestamp='1235576002' post='1786937']
Could the PostgreSQL driver perhaps be made into a community project for IP.Board 3? I'd gladly spend some time working on it with Nime, I have an interest in seeing an actively maintained version of it.


++

ZackL likes this

Share this post


Link to post
Share on other sites

Posted

It was actually planned to be so, but after I have decided not to upgrade to 3.x in the nearest future (waaaay to much work), I wasn't able to commit my time on that... not sure about others who expressed initial intereset. I hope this will be made available at some stage, otherwise I will have to do it one day myself again ))

Share this post


Link to post
Share on other sites

Posted

Funny coincidence. 10 days after my last post we have made a decision to upgrade to 3.x :)

Expect some news on PostgreSQL driver in the next few weeks. Anybody still wants to help?

Share this post


Link to post
Share on other sites

Posted

OK, thanks to a good abstraction layer in 3.x I have managed to set my board up and running on alpha-version of the driver. All the basic functionality, like posting, PMing, reading, subscribing etc. works fine now. More work needed now on the custom stuff like reports.

I will send an invite to join, to those who expressed interest on this topic, but if there is anybody else who wants to contribute, please let me know here or via PM.

Share this post


Link to post
Share on other sites

Posted

Driver for PostgreSQL is a very good idea. I talked earlier of the IPB, and claimed that they are in the process of developing driver - unfortunately, a zero specific information about the official support for PostgreSQL.

IPB: PostgreSQL support please!

Nime: when you have written a driver for PostgreSQL? I'm happy to buy it :)

Share this post


Link to post
Share on other sites

Posted

I have actually migrated my board to postgresql 2 days ago. While I still have a number of issues, most of them are not directly related to the driver, and by and large migration was successful. I still have a handful of open bug reports with IPB though )

I will be setting up a plain new board on my new website some time this week, that will be running postgresql, which wouldn't have any migration issues and could serve as a first running example of a fresh postgresql installation.

Honestly, I did not have any plans to sell it (not sure if I am allowed to at all), but rather release this for community :) may be i should have :D

Share this post


Link to post
Share on other sites

Posted

Which version of PostgreSQL do you have? Are search engine is based on the full-text TSearch2?

Yes, I see your tickets in the bug-tracker - most of them have the status of fixed in version 3.1 beta 1.
Maybe there will be official driver for PostgreSQL? :)

Share this post


Link to post
Share on other sites

Posted

I use 8.3. Full-text is not based on tsearch2, since I use sphinx. I have done some work originally on using tsearch2 and it is not hard to add, but ended up using sphinx since it is much better optimized for quick searching than any other solutions.

Share this post


Link to post
Share on other sites

Posted

We were hoping to do a public beta during next week or so. Not sure if IPS has plans to make driver official.

Share this post


Link to post
Share on other sites

Posted

This is good news for me:)
I have several websites that operate based on PostgreSQL and I did not see the possibility of making the MySQL server specifically for IPB.

Sphinx is a good search engine, but is available only for *nix platform, which narrows its usefulness.

Share this post


Link to post
Share on other sites

Posted

http://www.sphinxsearch.com/docs/current.html#installing-windows

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Who's Browsing   0 members

    No registered users viewing this page.