October 14th, 2002, 11:26 AM
freebsd + postgresql
I've seen evidence of what an awful combination freebsd + mysql can be - supposedly due to the threading implementation of the latter (http://jeremy.zawodny.com/blog/archives/000203.html). On our webserver, the cpu usage of mysqld can jump up to 95+%.
Is this an issue for postgresql? I have postgresql running on freebsd and have not had any trouble with it, although it has not been stress tested.
October 14th, 2002, 12:23 PM
I don't know if I would call it an _awful_ combination. I have never seen serious problems with MySQL on FreeBSD, but I definitely can say that FreeBSD+PostgreSQL is a great combination.
I think usually MySQL load problems happen for different reasons. With standard MyIsam tables, for example, MySQL still locks the whole table for updates. This doesn't pose a problem for read-intensive systems, but many websites are trying to save session vars in the database these days. This means that every single query by any browser which updates a session var will cause a full table lock, which can top out your system quite fast. I had this problem on a RedHat Linux system I was helping someone with. They were saving many session vars in the database, and we ended up with MySQL taking more memory than Apache, and running just as many processes+1, and taking up all the available CPU.
But anyway, I think that PostgreSQL and FreeBSD is the most natural combination possible. In fact, I believe most PostgreSQL development is done on FreeBSD machines. PostgreSQL actually comes from the same place as BSD: Berkeley, and it is released under the BSD license. And of course, PostgreSQL is process-based, although there is cautious talk of adding some threading support in the future.
A note on FreeBSD and threading: yes, as I understand it, FreeBSD is a little behind Linux in threading capabilit (wait 'til version 5.0). This is partly because BSD develops at a much more careful pace than Linux, resulting in very stable systems. On the plus side, FreeBSD handles process starting and stopping better than Linux. There is still a lot of debate among serious developers on the importance of threading for performance. (there are some good discussions in comp.databases.postgresql.hackers, if you search for 'thread'). Some say that a very efficient process-oriented model can handle as much load as a threaded model, and is much simpler to implement. There are of course pros and cons all the way around, but it seems that generally, the smaller the kernel, the more efficient it can be with processes, while larger kernels need threads to do anything efficiently (such as Solaris or Windows 2000).
Last edited by rycamor; October 14th, 2002 at 12:27 PM.
October 14th, 2002, 02:38 PM
Thanks for the info. We are using myisam tables with an import of data every 10 mins, so perhaps therein lies the problem, although the old linux webserver didn't show these symptoms. I've recompiled with linux threads to see if that might help matters as well and will see about converting from myisam along with the reinstall tonight.
Great, that was what I was hoping to hear!
October 14th, 2002, 08:08 PM
Just wanted to add that we use Postgres with FreeBSD also. It's a natural fit. Also there are many shops in our area using this combo (and MySQL) to serve up some heavily trafficed web sites.
5.0 has been around for a long time now, so for a release candidate, it's pretty mature, and the final release is due out in November. Though I will probably wait for 6 months before venturing into 5.0. (Will be 5.1 by that time).
Personally I think threading is overrated. Interesting point rycamor about the kernel, since in FreeBSD it's already a minimalist kernel, and is easy to clean out all the non essential driver support to make it even smaller.