wrap-up of mysql meetup featuring cto of huffington post

So I went to the NY MySQL meetup.  It was pretty interesting to hear first-hand the thoughts of someone using MySQL in a heavy trafficked environment.  They’re essentially running huffpo on a heavily customized movabletype system (php) on 14 front end web servers, 4 memcached servers and 7 mysql servers.  They couldn’t move to MySQL on ec2 because the max memory limit for their big servers were too small (they must have some heavy hardware going).

OK, so onto the interesting stuff:

They have a dual master setup, while running 5 slaves using MySQL 5.0.x and apparently almost all tables are on InnoDB.  The second master was primarily for a hot backup of the site.  They’ve setup memcache to take load off the mysql servers, and interestingly enough, they’ve moved session storage actually into memcache instead of mysql.  Their reads come from the slaves, but HuffPO CTO said specifically that it’s only for stuff that can be a few seconds behind the prod server.  Any sort of statistical stuff comes off the slaves as well.  One interesting thing they noted was that at times of extreme load, they have the ability to turn on and turn off features.  Also, they’ve mentioned that they add another level of cache upfront using Akamai to deliver dynamic pages.

They’re currently shifting to using ssd’s for their table storage and a new san for their log storage on a new hardware.  They’ve also setup a load balanced vip for clustered access to the slaves.    Overall I thought it was interesting to hear how they’ve setup their enviornment.

One thing they did note was that they had tried to use memcached on each of their 14 web servers but that they had synchronization issues across the servers, each cache would lose itself then force a rehash across all the servers.  Instead of keeping it on 14 servers, they consolidated to run it on 4 servers, which upped the cache hit rate from the 25% that they were getting.

An interesting thing he did mention was that they give a potential hire a link to an ec2 image that need to use for a test.  If they can’t pass that test then they’re most likely not technical enough to go on.  Pretty great idea.

symfony forms 1.2: adding multiple postvalidators

Here’s a tip for the symfony folks:

adding multiple postvalidators:

$this->validatorSchema->setPostValidator(new sfValidatorSchemaCompare(‘password’, sfValidatorSchemaCompare::EQUAL, ‘password_again’, array(), array(‘invalid’=> ‘Password and Password Again do not match.’)));
$this->mergePostValidator(new sfValidatorSchemaCompare(‘email’, sfValidatorSchemaCompare::EQUAL, ‘email_again’, array(), array(‘invalid’=> ‘Email and Email Again do not match.’)));

If you use sfValidatorAnd in your forms, the individual error messages no longer matter.  The error message of the sfValidatorAnd is used instead.

‘email’             => new sfValidatorAnd(array(
new sfValidatorString(array(‘max_length’ => 60)),
new sfValidatorEmail()), array(), array(‘required’=>’Email is required.’, ‘invalid’=>’Email is invalid.’)),

Finally, to get to all the errors in the form:

$form->getErrorSchema()->getErrors()

to get to all the global errors in the form:

$form->getGlobalErrors()

symfony error: Duplicate table found: propel

Some problems occurred when executing the task:
build-propel.xml:479:1: Duplicate table found: propel.
build-propel.xml:465:121: Execution of the target buildfile failed. Aborting.
If the exception message is not clear enough, read the output of the task for more information

So when you’re reverse engineering a database schema, you’ll likely get this error if you have plugins installed and you try to do a propel:build-model. For instance, if you have a an existing database and you’re doing a ./symfony propel:build-schema, it will go in and create a new schema.yml for you.  But, you have tables in there that the plugins will take care of, so there will be a conflict.  To fix this, you should go into the generated schema.yml and clear out the additional tables.  Then run the build-model again.

Customized 404, 500 error pages in symfony

Ok, the documentation on the web is a little confusing. So let me try to clarify it:

404 pages can be customized and used in the action/template settings.
500 pages can not not customized to use an action/template setting.

404 pages can be linked to action/template settings in the settings.yml file of your application by adding:

.actions
error_404_module: module_name
error_404_action: action_name

500 pages need to be setup in your web/errors/ directory under the error500.php page. This page does not take a template and is its own page.

UPDATE: in symfony 1.2 it looks like the error pages are now in config/error/error.html.php  (annoying)

-d