php: All content tagged as php in NoSQL databases and polyglot persistence
Thursday, 12 July 2012
MongoDB for PHP Developers
A two-part MongoDB tutorial for PHP developers: first part covering installation and the second giving a brief intro to MongoDB PHP API for queries and indexes. While not the tutorial that will get you up and running, it’s still a good resource for beginners.
Original title and link: MongoDB for PHP Developers (©myNoSQL)
Friday, 11 May 2012
Calculating the Cost of Storing PHP Sessions Using Amazon DynamoDB
Aside from nominal data storage and data transfer fees, the costs associated with using Amazon DynamoDB are calculated based on provisioned throughput capacity and item size (see the Amazon DynamoDB pricing details). Throughput is measured in units of Read Capacity and Write Capacity. Ultimately, the throughput and costs required for your sessions table is going to be based on your website traffic, but the following is a list of the capacity units required for each session-related operation with the assumption that your sessions are less than 1KB in size:
Reading via
session_start()
With locking enabled: 1 unit of Write Capacity + 1 unit of Write Capacity for each time it must retry acquiring the lock
With locking disabed: 1 unit of Read Capacity (or 0.5 units of Read Capacity if consistent reads are disabled)
Writing via
session_write_close(): 1 unit of Write CapacityDeleting via
session_destroy(): 1 unit of Write CapacityGarbage Collecting via
DyanamoDBSessionHandler::garbage_collect(): 0.5 units of Read Capacity per KB of data in the sessions table + 1 unit of Write Capacity per expired item
Nice translation of PHP function calls to effective Amazon DynamoDB capacity units.
Original title and link: Calculating the Cost of Storing PHP Sessions Using Amazon DynamoDB (©myNoSQL)
via: http://aws.typepad.com/aws/2012/04/scalable-session-handling-in-php-using-amazon-dynamodb.html
Friday, 6 April 2012
DynamoDB Libraries, Mappers, and Mock Implementations
A list of DynamoDB libraries covering quite a few popular languages and frameworks:

A couple of things I’ve noticed (and that could be helpful to other NoSQL database companies):
- Amazon provides official libraries for a couple of major programming languages (Java, .NET, PHP, Ruby)
- Amazon is not shy to promote libraries that are not official, but established themselves as good libraries (e.g. Python’s Boto)
- The list doesn’t seem to include anything for C and Objective C (Objective C is the language of iOS and Mac apps)
Original title and link: DynamoDB Libraries, Mappers, and Mock Implementations (©myNoSQL)
Monday, 30 January 2012
PHP and MongoDB Tutorial
Derick Rethans’s1 slides are a good MongoDB tutorial for PHP developers covering most of the API.
Wednesday, 13 April 2011
Activity Feeds with Redis
The how:
One brief note about architecture: since it’s impractical to simply query the activity of 500 friends, there are two general approaches for building scalable news feeds:
- Fan-out on read (do these queries ahead of time and cache them)
- Fan-out on-write (write follower-specific copies of every activity so when a given user asks for a feed you can retrieve it in one, simple query)
And why Redis:
First off, why Redis? It’s fast, our data model allows us to store minimal data in each feed entry, and Redis’ data-types are pretty well suited for an activity feed. Lists might seem like an obvious choice and could work for a basic feed implementation, but we ended up using sorted sets for two reasons:
- If you use a timestamp as the score parameter, you can really easily query for feed items based on time
- You can easily get the union of multiple sorted sets in order to generate an aggregated “friend feed”
Original title and link: Activity Feeds with Redis (NoSQL databases © myNoSQL)
Friday, 21 January 2011
Create a blog with MongoDB and Zend Framework
We never run out of the “hello worlds” of the web applications NoSQL-based blogs:
Now this article should have given you a good idea of just how easy it is to integrate MongoDb and the Zend Framework, specifically with the Shanty-Mongo library. I appreciate that there are a lot of things that I’ve not covered here, like the forms, proper security and more thorough validation. I’ve also not gone in to a lot of detail about the wide variety of features that are available with MongoDB, such as storing documents and exactly how replication works. But I hope that I’ve whet your appetite for learning more.
We’ve had a blog engine based on MongoDB using Mongomapper and also a guide to Zend and MongoDB to be run on one of the MongoDB cloud hosts, but never a blog with MongoDB and Zend. All combinations allowed!
Original title and link: Create a blog with MongoDB and Zend Framework (NoSQL databases © myNoSQL)
Tuesday, 11 January 2011
Redis and PHP: What Library to use?
Ori Pekelman discusses in two posts — here and here — the status of the various PHP libraries for Redis:
After looking at all of these I quickly turned to the C extension, Redisent looked nice but did not implement the new unified bulk protocol, and to be true, the code was a bit buggy. The others (Predis, Rediska ) seemed like bloatware, that capture the real essence of PHP (making complicated incoherent APIs) while missing that of Redis (Simple, Fast, Awsomeness).
As you can imagine such a comment generated some reactions and Ori followed up with a (not exactly scientific) benchmark:
While initially considering 6 PHP libraries (phpredis, Predis, Redis PHP bindings (deprecated), Redisent, Rediska), the benchmark didn’t include Rediska as the library is defining a too custom API for Redis.
Do you have a different experiences with any of these Redis PHP libraries?
Original title and link: Redis and PHP: What Library to use? (NoSQL databases © myNoSQL)
Sunday, 5 December 2010
CouchDB and PHP Video Tutorial
Besides LAMP, you can now learn about LAP(hp)-CouchDB-:
PHP developers generally use MySQL, but the rise of NoSQL databases has opened up new options for creating web apps. CouchDB’s unique replication feature set and easy API make it a great fit for PHP developers looking to move into a NoSQL database.
Original title and link: CouchDB and PHP (NoSQL databases © myNoSQL)
Monday, 18 October 2010
PHP Doctrine and CouchDB
I already mentioned Doctrine support for CouchDB, but couldn’t find the reference before:
As I blogged recently we started working on CouchDB support on top of the Doctrine2 infrastructure back at FrOSCamp. […] Like I was in #couchdb on freenode the other day and David asked a fairly legitimate question: “can you enlighten me as to why you’d need an ORM on top of native json object”? In this blog post I will try to explain why it makes sense to add a model based infrastructure underneath a NoSQL database.
Still not completely convinced
Original title and link: PHP Doctrine and CouchDB (NoSQL databases © myNoSQL)
Friday, 8 October 2010
Doctrine: MongoDB Object Document Mapper for PHP
Jonathan Wage’s preso:
And I think I’ve read the Doctrine is now working on tightly integrating with CouchDB too.
Original title and link: Doctrine: MongoDB Object Document Mapper for PHP (NoSQL databases © myNoSQL)
Most Popular Articles
- Translate SQL to MongoDB MapReduce
- Tutorial: Getting Started With Cassandra
- CouchDB vs MongoDB: An attempt for a More Informed Comparison
- Cassandra @ Twitter: An Interview with Ryan King
- A Couple of Nice GUI Tools for MongoDB
- NoSQL benchmarks and performance evaluations
- Ehcache: Distributed Cache or NoSQL Store?
- Document Databases Compared: CouchDB, MongoDB, RavenDB
- Quick Review of Existing Graph Databases
- NoSQL Data Modeling
