I have some data which I rarely have to update. Further I want that data to be very fast to access. What kind of solution do you recommend me in Zend Framework. The options I thaught are a Mysql database, some XML files, or directly writing the data in php arrays... Is there any ORM library I should use?
Since you're already using Zend Framework, why not use Zend_Config and store the data as ini/xml/json/yaml.
That's how Zend already stores your application settings. And if it's really not that much data, just store it in application.ini.
I'd say you can use whatever you want in your backend but then wrap it in Zend_Cache. This way you have some control over a refresh cycle but also the data in a convenient way and fast access.
Don't use an ORM if your aiming at fast access. Use an ORM for easy developing.
The fastest solution is storing this data in a plain PHP array I guess. But it's not the best solution if you ask me.
What kind of data are we talking about? How often and when does is change?
Store your data in a MySQL database but also index it using Zend_Search_Lucene.
Retrieving the data from a Lucene index is pretty fast from my experience
My favorite option in this cases is use Zend Cache. If you want to optimize the response time even more you can use the memcached library http://memcached.org/ . That can be used with Zend_Cache with little effort.
Related
I am working on making a search engine, I have to store multiple data against one word, how it will be done using php without use of JSON.
and is it a good approach to do this work in php or I should switch to another Object Oriented Programming Language ?
If its research project, you could give a shot with PHP7 (its faster). PHP5 will also let you achive what you want.
What language you chose is mainly dependand on what you want to achieve. C++ is surely faster than PHP.
Also you would need to check about bigdata handling and non-relational databases (MongoDB for example) which are scalable.
I was wondering what would be the best way to store JSON/XML responses. I'm currently building an application that supports heavily on the SoundCloud API to fetch songs/playlists etc.
Here are some ideas I've come up with.
Storing the results in a Relational Database and then using PHP to convert them to classes to make easy use of them throughout my application.
Doing the above, only this time using my framework's built-in ORM.
Using a Document-Oriented Database. (ie. MongoDB, couchDB, ...)
Storing the JSON responses in a cache. (using my framework's cache classes)
Can anyone care to shed some light on some of the advantages/disadvantages of using any of these methods?
Which one do you prefer?
If you have a solid schema, that you wont think it will change, you might want to use relational database. You will need to parse the json and make objects out of the JSON response and using your framework you can persist it to database.
If you think your schema will change use NoSQL.
It also depends what will you do with this data. Are you going to search the nodes within JSON?
You can also do a object to mongo mapping, you can either parse the JSON and store it as an object or you can store the JSON the way it is.
Nice thing about NOSQL is that they support JSON pretty well in which they use BSON (Binary JSON).
In terms of cache, IME, it should be used only for lookups, and actually, you cant search the cache. It s just for getting objects faster than going to database and getting it.
Take a look at this:
http://www.mongodb.org/display/DOCS/Inserting#Inserting-JSON
If you can tolerate hosting your music and playlist data on Google's AppEngine, Ubud-db can be something for you: https://bitbucket.org/f94os/ubud-db/wiki
Ubud-db is a document store on AppEngine with a REST-JSON API. Spring/Jackson maps from JSON to a Map, and then Ubud's service maps from the Map to Entity, persisted by the Datastore.
The REST-JSON API makes it easy to integrate with a website using AJAX to access and display dynamic data.
If I need keep the data for longer than a cache provider, I would store them in a database as-is and then just json_decode them when I retrieve them from the DB. If it's just temporary storage, cache is a great idea, still leaving it encoded as json to reduce the size.
I am thinking about writing a quick chat application for a client to help them solve some of their communication needs. Clearly, writing a simple chat is no brainer, but the company have serious scaling needs, so it is probably a good idea to build the service on a noSQL storage from the beginning.
Besides the obvious lack of transactions, which isn't one of our concerns, is it a good idea to use a noSQL storage for a chat?
MongoDB should be good enough if you're after scalability and performance. Most SQL engines would be overkill for this stuff. I doubt if you need complex data aggregation and other queries for chat data. Even with that, MongoDB has map-reduce capability to help you along.
NoSQL ist used if you have no fixed data model, this applies to document oriented applications where you have to store objects and documents where each one may have a different structure.
I don't think this is the case in your situation, since a chat log has a well defined fixed data model for example (user, time, text). I think a traditional SQL database may be the right fit for you. If used on client side only, SQLite will be the best fit, since there is no need to install or configure, simply redistribute the SQLite dll. Also the footprint is very small.
I would say no. SQLite is included in PHP... why not just use that? Or better still, why not use one of the hundreds of chat applications that already exist, and save yourself a whole load of development time.
I need to build a simple web-based data entry/editing tool - something that would let me avoid using MS Access for the task. Preferrably in PHP and something that would be support SQLite, foreign keys/references and field validation.
I've looked at the demos of Symfony and was not impressed with the user interface in the end. Are there any other frameworks/tools that can work for this?
Whilst not expressly web-based you could consider:
http://www.sqliteexpert.com/
The only ones I know of are:
http://phpsqliteadmin.sourceforge.net/
http://www.sqlitemanager.org/
There not to good looking but they may work for what you want.
I'd plug my own dynamic database CMS system, but I have a feeling you would need some modifications for what you want. Any reason speicifically you need SQLite instead of mySQL?
Here it is just in case... UltraPanel PRO
My query is how can i store data in secondary memory by fetching it from database and then displaying it in small units using zend framework coding ?
It's hard to work out exactly what you mean. If you are finding database access too slow, then you should use caching to store the results received from the database into files or memory. If you are storing to memory, then the memcached server is very popular.
Zend Framework provides the Zend_Cache component to help you manage storing, retreiving and expiring cached data. It also allows you to easily change the "back end" storage system from file to memcached so that you can compare performance.
Some useful links:
http://framework.zend.com/manual/en/zend.cache.html
http://www.talkincode.com/a-simple-introduction-to-zend_cache-1048.html
http://www.slideshare.net/akrabat/caching-for-performance
You are looking for Zend_Cache and Zend_Paginator with ArrayAdapter