PHP class for Rest Interface

Details

Description

This is a php class to interact with the rest interface this is my first copy so there could be bugs and changes to come as the rest interface changes. I will make this in to a patch once I am done with it. there is lots of comments in the file and notes on usage but here is some basic stuff to get you started. you are welcome to suggest changes to make it faster or more usable.

Basic Usage here more details in notes with each function

// open a new connection to rest server. Hbase Master default port is 60010
$hbase = new hbase_rest($ip, $port);

This would make it easy for reads but for puts I would still have to keep it the same. I forgot about keep-alive been a long time sense I had to use fsockopen Myself but I will work on adding keep-alives into the code to keep the connection open so we do not have to tare down and rebuild the connection per transaction. This will help speed up the code.

Billy Pearson
added a comment - 09/Jan/08 00:58 This would make it easy for reads but for puts I would still have to keep it the same. I forgot about keep-alive been a long time sense I had to use fsockopen Myself but I will work on adding keep-alives into the code to keep the connection open so we do not have to tare down and rebuild the connection per transaction. This will help speed up the code.

It might be easier for you to use php's built-in http client, rather than writing the http client yourself. That way, you won't have to deal with chunked-encoding, keepalives, etc. (which you ignore, but you might get some performance improvements from them).

Michael Bieniosek
added a comment - 08/Jan/08 21:57 Hi Billy,
It might be easier for you to use php's built-in http client, rather than writing the http client yourself. That way, you won't have to deal with chunked-encoding, keepalives, etc. (which you ignore, but you might get some performance improvements from them).
To do the cell fetching, for example, you could just do:
$xml = simplexml_load_file( "http: //$host:60050/api/$table/row/$row" );
$content = array();
foreach ($xml->column as $column) {
$content[base64_decode($column->name)] = base64_decode($column->value);
}
return $content;

There is still a problem and I ma not sure if its my code or something with in the rest code but there is a memory usage after using it to insert a few million rows the master or/and the separate rest process (HADOOP-2316) runs out of heap memory there is something using up memory and not releasing it. I have seen it on inserts but have not tested for it much more then that. I run a separate rest process outside of the master so I can kill that with out having to restart the master and the whole cluster.

Billy Pearson
added a comment - 08/Jan/08 06:25 There is still a problem and I ma not sure if its my code or something with in the rest code but there is a memory usage after using it to insert a few million rows the master or/and the separate rest process ( HADOOP-2316 ) runs out of heap memory there is something using up memory and not releasing it. I have seen it on inserts but have not tested for it much more then that. I run a separate rest process outside of the master so I can kill that with out having to restart the master and the whole cluster.