Using Redis, Predis with my php application - php

As I was developing a php app I realised that my app is slow in terms of processing large sets of data in the catche. Decided to do something about it and went on to google to find some sort of solution or at least suggestions.
I came across Redis, after reading about it I would realy like to give it a go and test it out as it looks promising,
But I also stumbled into predis and phpredis, and thats when I begun to get confused. From what I understand i need predis or phpredis with my php app, but then where do I use Redis....? how should I build my stack...?
Redis->predis->php
Do I have to install both Redis and Predis/phpredis within my PHP directory in eg. lib dir..?
Also is there any significant difference between Redis and Phpredis

Redis is a standalone caching application: http://redis.io/ (plenty of documentation on how to install)
predis is a library for interacting with a running Redis application easily from within php. Phpredis is similar but requires compiling.
You can think of it like MySql and PHP. MySql is it's own application that you are able to communicate with via a PHP extension, MySql itself is not a part of PHP.
Your stack could be (apache / php5.3 / mysql / redis) with just the predis library.
You can run redis either on the same server or a different server, it's up to you.

Redis is a server that runs independently from your application (i.e. PHP) code. You can download it from here.
To talk to Redis, your application can do one of the following:
Implement Redis' protocol, i.e. RESP
Use a client library
Most people go for option 2, which in PHP's case your options would be predis, phpredis or any of the other clients in the clients page or others that are unlisted by you can find in GitHub.

Related

Will Predis be able to interact with a newer Redis version?

I'm working on writing a script to compare a couple caching methods my team will be using. I'm trying to set up a Predis client that will interact with the Redis already running there. The Redis that is running on the server is clocking in at version 4.0.9, while the latest predis notes list support for Redis profiles from 2.0 to 3.2. I was just wondering if the functionality of simple commands that have existed since 3.2 of Redis will function the same when using predis with our 4.0 config. If not, would I be able to just use exec to go through as if I was just using the command line interface?
As far as I remember there were no API breaking changes for "simple" commands since 3.2. That said, it is possible that you won't be able to use the newer commands. Perhaps you should consider using Phpredis that is more up to date and maintained.

IBM PHP instance php buildpack for max number of request

I'm using a PHP instance within IBM Bluemix.
Now we are posting raw data from about 200 external devices to a PHP instance.
This rawdata is small (1 or 2 KB), but it sends every 4 to 5 seconds.
If I'm using the standard PHP buildpack, I see that the webpage sometimes won't respond. (It looks like it is waiting for a free client connection.)
Could anybody tell me which PHP buildpack is the best buildpack for using in PHP instance?
The PHP instance within IBM Bluemix is the opensource cloudfoundry php-buildpack buildpack. You can try the current version of the buildpack to see if your issue is resolved. For example if you would like to use the latest version you can push your app with:
cf push yourAppName -b https://github.com/cloudfoundry/php-buildpack.git
If you need further help please include code examples, logs and anything else that can help with debugging your issue.
Assuming that the problem is related to the used buildpack, you could take a look at Heroku buildpack: PHP. It uses Composer for dependency management, supports PHP or HHVM (experimental) as runtimes, and offers a choice of Apache2 or Nginx web servers.
You could try this buildpack as an alternative to the default one. I suggest you to test both the web servers to see if you notice different performances with the load spikes.
If the problem persists I think you should do a deeper performance investigation. You could also use one of the services provided by Bluemix in the DevOps catalog.

using socket.io with PHP server

I am implementing socket.io in an Open Source PHP application. But socket.io is not work directly on PHP server.
In their document they have proposed a PHP solution, and its look fine. but main problem is that their propesed solution: https://github.com/rase-/socket.io-php-emitter need two PHP extensions to be installed msgpack-php and phpredis. And this extension are generally not installed in PHP server.
As my application is Open Source and most of our user will use it on shared hosting, where they are not allowed to install any PHP extensions.
My question is
Is there any PHP client library for msgpack-php and phpredis with easy integartion.
OR
Is there any PHP REAL-TIME ENGINE for pusing content to client side ?
Thanks for being helpful.

How can I access a Lotus Notes Database from PHP5

I would like to access our Domino Databases from php.
My php5 is running in an Linux environment OpenSuse and for development Debian based System. Domino Server 8.5.1 is also running on a OpenSuse Server.
Currently I'am accessing the Databases via parsing the web pages from Notes, but that is a horrible way to do that.
Are there any ways or ideas to access Notes an more comfortable way?
Yes, there are plenty of ways. You can use Domino Designer to write a web service on the Domino server to expose the data that you want, and access the service that from your PHP code. You can use REST APIs if your Domino server can be upgraded to 8.5.3 or higher. You might be able to install Domino on your OpenSuse server and have your PHP code invoke Java programs that use the Notes classes in Notes.jar to do the work, or you can actually do that without installing Domino, but you'll have to use the remote version of the classes in NCSO.jar and your server will have to enable CORBA. You can use ODBC and NotesSQL as discussed here. I'm listing that last even though you did put an ODBC tag on your question because Notes databases are not relational and I find thinking of them that way to be too limiting, but if your data fits a relational model and you're comfortable with it, then it might be your best choice.
What Richard said, except I would start with this link for REST APIs. That takes you to the latest product documentation. Richard's link takes you to a slightly outdated page on OpenNTF.

Performance of MongoDB on VPS or cloud service not having mongoDB installed

I have to build a web application which uses Python, php and MongoDB.
Python - For offline database populating on my local home machine and then exporting db to VPS. Later I am planning to schedule this job using cron.
PHP - For web scripting.
The VPS I wish to buy supports Python and LAMP Stack but not mongoDB (myhosting.com LAMP stack VPS) by default. Now since mongoDB isn't supported by default, I would have to install mongoDB manually on VPS. So what I want to know is that, had it been my VPS would have supported mongoDB would I have benefitted in terms of performance and scalability.
Also can someone please suggest a VPS suitable in my case.
Well, there is no such thing as a stainless steel requirement of MongoDb. It will run where it's possible to get it's binary compiled so to speak.
But you might be disappointed by it's performance on slow machines or weak VPSes, but that is something you can find out by testing your workload only. You can also check related SO posts:
Memory Requirement/Utilization for MongoDB, Riak and HyperTable (or HBase)
mongodb install - requirements?
And Google Groups post.
If the vps you are looking at restricts the packages you can install, and you need something that they prohibit, I would look for another vps. Both rackspace and amazon a range of instances, and numerous supported os. With either of them you choose your operating system and are free to install whatever you want.

Categories