 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPMaster.com: MongoDB Revisited
by Chris Cornutt January 17, 2012 @ 12:44:07
In this new post to PHPMaster.com today Ahmed Shreef continues on from his previous introduction to MongoDB and gets into more detail on things like cursors, query operators, queries on embedded documents and the sort/skip methods.
In my previous article Introduction to MongoDB I discussed installing Mongo, its PHP extension, and how to perform simple insert and find operations. Of course there are many, many more features than what I mentioned so I wanted to write another article to show you some of them.
Other topics mentioned include queries on arrays of data and running queries with indexes to improve their performance. Code is also included for each example.
voice your opinion now!
mongodb tutorial cursor query index sort skip
Johannes Schlüter's Blog: MySQL Query Analyzer and PHP
by Chris Cornutt September 30, 2011 @ 12:56:54
Johannes Schlüter has a new post to his blog today mentioning the beta release of the mysqlnd_ms plugin (previously mentioned by Ulf Wendel and a new feature that can be plugged into the MySQL Enterprise Monitor to make the Query Analyzer directly use PHP instead.
When running a PHP-based application with MySQL it is often quite interesting to see what actually happens on the database sever. Besides monitoring of the system load etc. it is often interesting to see what queries are actually executed and which of them are expensive. A part of MySQL Enterprise Monitor is the MySQL Query Analyzer which helps answering these questions.
This was handled via a proxy that sat between the database and app server and ran through the queries looking for improvements. This new plugin keeps it closer to PHP itself without having to hit against the proxy. You can see the result in these two screenshots from inside the Manager application. You also have the side benefit of getting a stack trace of it running through the app to help you identify the spots most needing improvement in the code too.
voice your opinion now!
mysql query analyze mysqlndms plugin enterprise monitor
Rafael Dohms' Blog: Using theFacebook PHP-SDK to run FQL
by Chris Cornutt January 12, 2011 @ 13:19:21
Rafael Dohms has a new post to his blog today looking at using the Facebook PHP-SDK to run FQL queries on the data for your applications.
The new SDKs have not, as you can say, fallen far from the tree. While they are really great new and shiny, documentation on how to use them is still vague, missing or spread out in the internet in blogs like these, in posts from us users trying to share the information with other soon-to-be-suffering developers. So this is an example of this, i have been using these new resources and the new PHP-SDK and have ran into various walls, so I decided to start putting some of this on my blog, for 2 reasons: to spread the word, and to have notes for myself when I come back to this.
The post gives an example of using the "api" method provided by the PHP SDK from Facebook to push an array of parameters, one being the query, to the remote API for parsing. He includes the code for a simple (namespaced) helper to take in the query and return the API's return data set.
voice your opinion now!
facebook sdk fql api interface query sql
Gonzalo Ayuso's Blog: Speed up PHP scripts with asynchronous database queries
by Chris Cornutt October 11, 2010 @ 11:49:53
In a new post to his blog Gonzalo Ayuso has a suggestion for speeding up your scripts that use multiple database connections, possibly ones with larger queries that could take a while to run - asynchronous query handling.
That's the situation. A web application with 4 heavy queries. Yes I know you can use a cache or things like that but imagine you must perform the four queries yes or yes. As I say before the four database queries are heavy ones. 2 seconds per one. Do it sequentially, that's means our script will use at least 8 seconds (without adding the extra PHP time). Eight seconds are a huge time in a page load. So here I will show up a technique to speed up our website using asynchronous calls.
Since PHP doesn't really support threading, he works around it by creating a separate script for each of the queries (obviously only practical for special cases) as a self-contained unit. Then the "master" script that needs the results of the queries calls each of them via asynchronous curl class (simply named "Fork") that sends off the requests and waits for each result to come back as a json result set.
voice your opinion now!
database asynchronous query curl json
ServerGrove Blog: Logging MongoDB queries using Symfony 2 and Doctrine ODM
by Chris Cornutt October 05, 2010 @ 10:56:43
On the ServerGrove blog today there's a quick new post showing a method you can use to log the queries to your MongoDB database in your Symfony2-based application.
Symfony 2 comes with native support to connect to MongoDB using the DoctrineMongoDBBundle. Getting started is quite simple and there is not much that needs to be configured, but the manual does not say how to enable query logging although it is already possible with Symfony PR3. Query logging allows you to debug queries sent to the DB server by writing them in a log file. It is very useful for cases when you issue a query and you are not getting the results you expected.
The key is to add a "logger_class" value into your Symfony configuration file pointing to the "DoctrineMongoDBLogger" tool. The queries will then show up in your normal log files. They include a sample line along with a brief explanation of the values inside.
voice your opinion now!
mongodb tutorial symfony doctrime odm log query
ThinkPHP Blog: MySQLnd Plugins Writing a MySQL Query Logger in PHP
by Chris Cornutt August 18, 2010 @ 11:10:15
On the ThinkPHP blog there's a recent post looking at writing a query logger in PHP as a mysqlnd plugin using the mysqlnd_uh extension.
A new approach to implementing a query logger and potentially more complex features such as monitoring or read/write-splitting is the MySQLnd Userland Handler Extension (mysqlnd_uh, pecl website). The extension lets you register a PHP class as a proxy for every MySQLnd connection. Every call to a function to MySQLnd (usually indirect through mysqli, mysql, pdo_mysql) is passed to the PHP class, which then calls the original MySQLnd function.
They give a simple example to start - a logging function and how to configure it - followed by a more real-world scenario of logging inside of a project plugin.
voice your opinion now!
mysqlnd query logger plugin extension
|
Community Events
Don't see your event here? Let us know!
|