Databases

How to build mongodb pecl extension in 32bit for PHP 5.2 on MacOSX Snow Leaopard

Unfortunately i have to support PHP 5.2 and i also need to run my Mac in 32 bit mode as my VPN client does not support 64 bit :(

This causes quite a lot of hassle as PHP 5.2 is less and less supported by frameworks, extensions etc. It is also waste of time as i have to manually build stuff instead of using regular packages, ports etc.

Here is a quick step by step guide on how to get mongodb and PHP5.2 mongo pecl extension going on your MacOSX in 32bit mode!

NOTE: 32 bit mongodb binaries have 2GB address space limit so you wont be able to process too much on your laptop. You will still be able to code and connect to remote instances just fine.

Very interesting problem with cacti and mysql strict mode!

It was very interesting as my cacti installation began failing today. For no apparent reason. I noticed CPU usage and CPU temperature going through the roof as PHP script ran by cacti was stuck in some infinite loop or active wait state. It seemed to query database non stop without sleeping or anything and it was not doing anything either.

I looked in error log and there was nothing, looked in access log of monitored server ... nothing again. Finally i looked into cacti log and found tons of messages like this:

Insert performance comparison of NoSQL vs SQL servers

I have played around with CouchDB half year ago and it's performance was just horrible. I have heard a lot of good about mongodb recently so i thought i will have a look at it.

I think that NoSQL can have really good use cases in web. The problem is that you need a really performant and stable system if you want to use it in production. I ran just a few simple tests so its not a real benchmark or anything. It is just a simple test trying to figure out how far behind are nosql solutions (performancewise).

Setting mssql query timeouts in PHP for each call separately - mssql extension patch

I have spent some time trying to figure out the way to set query timeout in mssql and its not easy. Below you can see the process i am using now, unfortunately it does not work with the current PHP mssql extension (to make it work you will need to apply my patch or get latest sources).

Why do you need the query timeouts?

In high availability sites you can not allow any pages to timeout. If there is a problem with the DB (index broken or server overloaded) You still want your customers to see the page on time. It may have banners missing or some footer broken but its still better than waiting 30s and getting a blank page. After 2-3 seconds most users will click refresh button (putting the last nail in your coffin).

Mysql linux shell commands to get tables list and basic statistics

Mysql is so common that its good idea to have some command line scripts or tricks. Sometimes you need to execute some SQL queries on set of tables or all of them or get stats or fix tables etc.

Its good to be able quickly get list of tables and basic stats.

You can make bash script of it or just type in the command line:

Review - High Performance Mysql

High Performance Mysql is hands down the best mysql book i have seen.

I would recommend it to everyone who wants to learn more about mysql, not only for gurus but for everyone. I would recommend it to sys admins and programmers. Especially if you are concerned by performance you should read this book.

Authors describes in details how mysql works, how to tune it, how to avoid benchmarking pitfalls and how to plan for scale.

Couch DB performance seems to suck

We are looking for some nice solution to store persistently object-like data. Few weeks ago we had a look at Couch DB and performance looked horrible. We did not even bother to make some more realistic tests as initial data was just disqualifying.

We want to store objects with very dynamic schema and be able to index some of the properties. For example we want all objects of type book with title equal to X. We need it to be very fast. And when i mean very fast i mean memcache-kind of fast ;- )

Good riddance mysql!

Recently open source community was shaken by news of Oracle taking over Sun. Well maybe Postgres will finally get its well deserved respect over mysql. You can also read here why do i prefere postgres over mysql.

How to convert drupal 6 site from postgres to mysql

I have a project that was set up on drupal 6 on postgres database as i always prefered it over Mysql.

I am currently in progress of moving some stuff to dreamhost.com (which RULES!) and i finally have shell access and i can actually do stuff. The only problem is they dont support pgsql at all! LOL! So i have decided that it takes too much effort and time to maintain it.

Here are 3 simple steps to migrate your drupal installation (possibly other apps) from postgres to mysql.

Syndicate content