Created
May 16, 2012 10:42
-
-
Save nmmmnu/2709432 to your computer and use it in GitHub Desktop.
Cassandra Iterator test on very long data set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
require_once(__DIR__.'/../lib/autoload.php'); | |
use phpcassa\SystemManager; | |
use phpcassa\Connection\ConnectionPool; | |
use phpcassa\ColumnFamily; | |
use phpcassa\Index\IndexExpression; | |
use phpcassa\Index\IndexClause; | |
$sys = new SystemManager('127.0.0.1'); | |
$pool = new ConnectionPool('DEMO', array('127.0.0.1')); | |
$users = new ColumnFamily($pool, 'urls'); | |
$x = $users->get_range(new IndexClause(new IndexExpression('type', 1984)), 0, 1000000 ); | |
$i = 0; | |
$mem = 0; | |
foreach($x as $key => $value) { | |
$i++; | |
$mem = $mem + strlen(serialize(array($key, $value))); | |
if ($i % 1000 == 0) | |
printf("%10d | %6.3f | %s\n", $i, $mem / 1024 / 1024, $key); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested and works well. PHP does NOT run out of memory.