Sep 16

PDO: PHP Data Objects
Wez Furlong (Message Systems, Inc.)
2:45pm Tuesday, 09/16/2008
The Basics Room 209

PHP 5.1 features a new data access layer, PHP Data Objects (PDO), that provides a clear, simple (but powerful), unified API for working with all our favorite databases. Features include prepared statements with bound parameters (for all databases, even those that don’t natively support them), transactions, cursors, LOBs, and flexible error handling. Also examined are the issues of cross-database portability and how best to use PDO to avoid some of the pitfalls associated with that topic. Join Furlong to learn more about the future of database access in PHP.
Photo of Wez Furlong
Wez Furlong
Message Systems, Inc.

Wez Furlong is Director of Engineering at Message Systems where he works on the fastest MTA on Earth.

Wez is a PHP Core developer and active OpenSource contributor. He currently resides in Sykesville, Maryland with his wife, son and loyal pup.

Website – http://netevil.org/

PDO::ERRMODE_SILENT
PDO::ERRMODE_WARNING
PDO::ERRMODE_EXCEPTION

forward-only cursors
-a.k.a. “unbuffered” queries in mysql parlance
-they are the default cursor type
-rowCount() doesn’t have meaning
-FAST
-other queries are likely to block
-you must fetch all remaining data before launching another query
-$stmt->closeCursor();

Fetch modes
-PDO::FETCH_COLUMN

Iterators
        $dbh = new PDO($dsn);
        $stmt = $dbh->query(
                “SELECT name FROM FOO”,
                PDO::FETCH_COLUMN, 0);
        foreach ($stmt

Changing Data
        $deleted = $dbh->exec(
                “DELETE FROM FOO WHERE 1”);
        $changes = $dbh ->exec(
                “UPDATE FOO SET active=1”
                “WHERE NAME LIKE ‘%joe%’”);

Autonumber / sequences
        $dbh->exec(
                “insert into foo values(…)”);
        echo $dbh->lastInsertId();

Prepared Statements
$stmt = $dbh -> prepare(
        “INSERT INTO CREDITS (extension, name)”
        “VALUES(:extension, :name)”);
$stmt -> execute(array(
        ‘extension’ => ‘xdebug’
        ‘name’ => ‘Derick Rethans’
));

written by Cousett \\ tags: , , , ,

Sep 16

PECL Picks – Extensions to make your life better
Elizabeth M Smith (OmniTI)
1:30pm Tuesday, 09/16/2008
Advanced Hall B

PECL is undergoing a transformation, new developers, new tools, and a clearing away of the old cruft. Learn the history and idea behind PECL and where the future is leading, and who is involved in the process.

Then take a walk through PECL and learn about the best and the brightest. PECL extensions fall into three rough categories. Library wrappers take a C library and bring the functionality to PHP, general libraries add new functionality to PHP through internal C code, and engine level extensions allow you to do cool things with PHP.

Each extension will have a brief overview, who maintains it, the requirements and purpose of the extension, and a quick “how to use it”. There are 184 extensions in PECL and more on the way, we’ll see how many useful ones fit into an hour.
Elizabeth M Smith
OmniTI

Elizabeth M. Smith has been using PHP since time immemorial (PHP 4.0beta), but has used PHP 5 for so long now she’s forgotten how she ever got by without SPL and a real object model. Elizabeth is a certifiable (yes, we mean men in white coats coming to put on strait jackets) windows geek, if it can be compiled on windows, she’ll compile it, if not… she’ll fix it so it does. She enjoys doing very perverse things to Windows using PHP as well – all this in between caring for her 4 kids and husband.

* Web site

Text Extensions
        - bbcode
        -colorer
        -doublemetaphone
        -enchant
        -namazu
        -stem
        -xdiff

bbcode
        provides various tag types, high speed tree based parsing

tell it how to parse what to parse

Search
        - clucene
        - mongosearch
        -swish
        -sphinx
                -libsphinx www.sphinxsearch.com
PHP do bad things
        -runkit
        -funcall
        -intercept

        Runkit
        - replace rename remove user defined functions and classes
define customized superglobal variables for general purpose use

        Funcall
        - code.google.com/p/funcall
        - call callbacks before or after specified call

http://elizabethmariesmith.com/slides/pecl-picks.pdf

http://elizabethmariesmith.com/slides/

http://pecl.php.net/

written by Cousett \\ tags: , , , ,

Sep 16

Static and Dynamic Analysis at Ning
David Sklar (Ning, Inc.)
11:15am Tuesday, 09/16/2008
Advanced, Best Practices, Performance Hall B

Ning’s “Your Own Social Network” application is 160,000 lines of PHP that powers hundreds of thousands of social networks, each different than the others. To keep our platform humming along smoothly, as well as to keep our internal development processes sane, we need to know what all that PHP code is doing and how it’s structured.

Documentation is nice (and essential) but there’s no substitute for relying on the code itself as the canonical source for information about, well, the code. That’s where static and dynamic analysis come in.

Static analysis is scanning, parsing, munching, and otherwise processing our PHP source code to answer whatever questions we have about it. Who calls this function? What parts of the code do disk write operations? Are there any untranslated strings in our localization message catalogs?

Dynamic analysis gathers information from running code. How many times is a function called? How long does it take? When does our PHP code access the filesystem?

This talk discusses the static and dynamic analysis techniques that we use at Ning to understand and optimize our platform, including the PHP tokenizer, regular expressions, the vld and xdebug extensions, and the PHP DTrace provider.

David Sklar
Ning, Inc.

David Sklar is a Software Architect at Ning, Inc., and the author of PHP Cookbook (O’Reilly), Learning PHP 5 (O’Reilly), and Essential PHP Tools (Apress). He speaks regularly at many conferences, including the O’Reilly Open Source Convention, the O’Reilly Emerging Technology Conference, USENIX, and various PHP conferences. He keeps a blog at http://www.sklar.com/blog/ and maintaings the PX (http://px.sklar.com/), a PHP code exchange he created in 1996. David has a degree in Computer Science from Yale University and lives in New York City, where he enjoys riding the subway, eating salt-baked scallops, and admiring the 18th- and 19th-century American furniture at the Metropolitan Museum of Art.

written by Cousett \\ tags: , , , ,

Sep 16

Join-fu: The Art of SQL Tuning for MySQL
Jay Pipes (MySQL)
10:00am Tuesday, 09/16/2008
Advanced, Best Practices, Performance Hall B

Join-fu is the art of performance-tuning your application’s SQL. Join Jay in a fun, irreverent look at the common ways application developers misuse and abuse their database.

We will cover a number of important topics in tuning your SQL application layer. We will not be covering tuning server variables or benchmarking, but instead the slides will be full of SQL and PHP code that the audience can immediately use to dramatically increase the performance of their schemas and applications.

The talk focuses on MySQL, but the tips and techniques used can easily be used to increase performance in a number of RDBMS-driven applications.
Photo of Jay Pipes
Jay Pipes
MySQL

Jay Pipes is the North American Community Relations Manager at MySQL. Co-author of Pro MySQL (Apress, 2005), Jay has also written articles for Linux Magazine and regularly assists software developers in identifying how to make the most effective use of MySQL. He has given sessions on performance tuning at the MySQL Users Conference, RedHat Summit, NY PHP Conference, OSCON, PHP-Quebec, ZendCond and Ohio LinuxFest, amongst others. He lives in Columbus, Ohio, with his wife, Julie, and his four animals. In his abundant free time, when not being pestered by his two needy cats and two noisy dogs, he daydreams in PHP code and ponders the ramifications of __clone().

vertical partitioning – split tables with many columns into multiple tables
horizontal partitioning – split table with many rows into multiple tables

vertical partitioning
- mixing frequently and infrequently accessed attributes in a single table
- space in buffer pool at a premium
        - splitting table allows main records to consume the buffer pages without the extra data taking up space in memory
- need FULLTEXT on your text columns?

create a myisam indexing
        -replication answer master both in db slave … do fulltext indexing on slave

the MYSQL query cache
        - you must understand your application’s read/write patterns
        -internal query cache design is a compromise between CPU usage and read performance
        -stores the MYSQL_RESULT

http://jpipes.com/

written by Cousett \\ tags: , , , ,