 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Ole Markus' Blog: High load websites A lock on Memcachedget
by Chris Cornutt December 27, 2010 @ 12:34:14
Ole Markus has a new post to his blog looking at a technique for working with memcached and fetching data out of the store using a binary semaphore for better performance.
A typical document takes but a few hundred milliseconds to generate when a single request for the document enters the backend. The problem is that this is a highload website. In its current form, the backend serves hundreds of pages per second. This pretty much guarantees that the backend will concurrently receive cache miss on multiple languages and at the same time also receive cache miss on the pre-translated document.
Given that he wants the translated version to be the one that's always shared, a problem can come up when the cache request is "missed" and the document starts generating from multiple places. His fix for the situation is that only the first miss generates and all others see a lock on it and wait for it to be removed before successfully fetching the result. He provides code in a "LockedMemcached" class to help make it all more useful.
voice your opinion now!
lock memcache get set high load website varnish
Manuel Pichler's Blog: Howto create custom rule sets for PHPMD
by Chris Cornutt April 09, 2010 @ 13:19:25
If you've been using the PHP Mess Detector (PHPMD) to help clean up problem areas in your applications, but have needed more than just the basic rules that it comes with, you're in luck. Manuel Pichler has put together a new post for his blog about creating custom rules sets for the tool.
PHPMD can be seen as an one level down/low level equivalent to PHP_CodeSniffer. It is a simple command line tool that can be used to check your application's source code for possible bugs, suboptimal or overcomplicated code. The current release of PHPMD ships with three default rule sets.
The first deals with code size, the second checks for unused variables and the like and the third looks at naming conventions. He shows how to take one of the structures from one of these three and create a new rule. For his example it's a measurement of cyclomatic complexity. He also shows you how to exclude certain rules that might come in another set so you don't have to completely redefine to use pre-existing rules.
The latest release of PHPMD can be pulled from pear.phpmd.org or from its github repository.
voice your opinion now!
phpmd custom rule set tutorial
DevShed: Handling MySQL Data Set Failures in PHP 5
by Chris Cornutt October 29, 2008 @ 13:35:39
DevShed continues their look at custom exception handling in PHP5 application with this third part of their series, a look at handling exceptions from MySQL calls.
Having already introduced you to the main subject of this article series, it's time to summarize the topics that were discussed in the last article, in case you haven't read it yet. In that particular tutorial I explained how to implement a fully-functional customized exception system with PHP 5, which came in handy for handling a number of specific exceptions thrown by a basic MySQL abstraction class.
They create a custom MySQL exception class that sits on top of their MySQL abstraction layer (and Result handling class) and catches exceptions thrown from sample queries.
voice your opinion now!
php5 data failure set query mysql database abstraction exception
Jonathan Snook's Blog: Multiple Validation Sets in CakePHP 1.2
by Chris Cornutt July 23, 2008 @ 07:51:27
Jonathan Snook has posted two methods for creating multiple validation sets in the latest version of your CakePHP application.
In CakePHP, you define how your data should be validated by setting parameters on the validate property of your model. In version 1.2, there is an on option that can be set on a specific rule that, when set, is either create or update. [...] Despite that, I developed a slightly different approach that allows for different validation sets to be specified and to be cleanly separated from each other.
He overrides the validates() method with his own in a custom model in one of two ways - having the script check for a validation set for the current controller or by specifying it directly with a validationSet property. Code for both methods is included.
voice your opinion now!
cakephp framework validation set detect controller property define tutorial
Etienne Kneuss' Blog: SplFastArray to speed up your PHP arrays
by Chris Cornutt June 09, 2008 @ 12:54:04
Etienne Kneuss has posted about a new part of the Standard PHP Library that creates arrays that are up to thirty percent faster than normal methods - SplFastArray.
Antony got the idea to implement a C-like array wrapper in SPL: SplFastArray. The main advantage of that class is performance, it's indeed faster than PHP arrays. How so? No free lunch: The speedup comes from the fact that non-numeric indexes are not allowed and that the array is of fixed size.
The code sample shows the setting of the size for the array (and changing it) with a var_dump of the output result. This method is always faster than normal arrays, it just varies how much from system to system (anywhere from ten to thirty percent).
voice your opinion now!
spl splfastarray set size speed faster
Matthew Weir O'Phinney's Blog: Overloading arrays in PHP 5.2.0
by Chris Cornutt January 19, 2008 @ 08:01:25
In a new post to his blog, Matthew Weir O'Phinney talks about a method for overloading arrays in a script written for the PHP 5.2 series.
Several weeks back, a bug was reported against Zend_View that had me initially stumped. [...] I'd read about this some months back on the php internals list, but at the time hadn't understood the consequences.
Basically, __get() no longer returns a reference and returns values in read mode, which makes modifying arrays using overloading impossible using traditional methods.
Unfortunately, this was exactly the functionality that was needed, so Matthew set out to find a way to do just that. His initial method, extending the ArrayObject, worked but still gave errors. On Mike Naberezny's recommendation, though, this too was resolved with a simple call to the __set method instead.
voice your opinion now!
overload array arrayobject set get reference overload array arrayobject set get reference
Larry Garfield's Blog: Benchmarking magic
by Chris Cornutt November 08, 2007 @ 12:04:00
Larry Garfield has put together some benchmarks based around a request he had from other developers (the "performance czars") as to how the magic functions in PHP5 would perform in the new environment.
Already, there is talk of how, and if, to leverage PHP 5's object handling now that we don't need to deal with the weirdness of PHP 4's object model. Of course, because it's Drupal, our army of performance czars want to know just what the cost is for object handling, and especially advanced object magic like __get(), __call(), the ArrayAccess interface, and so forth.
He an his tests on a Thinkpad (Intel Core2 Duo 2.2Ghz) running Kubuntu and PHP 5.2.3. They were run two million times benchmarking the different methods for:
- function calls
- __call
- __get
- __set
- iterators (array)
- inheritance
- composition
His results are listed at the end of the post.
voice your opinion now!
benchmark magic function get set call iterator inheritance composition benchmark magic function get set call iterator inheritance composition
|
Community Events
Don't see your event here? Let us know!
|