开发者

Storing inbound data in memory in PHP

i am building a chat app on php-mysql backend. the problem i am facing is slow mysql read writes. i have done all sorts of optimization to my queries and mysql server , the problem is actually because of hundreds of concurrent http->mysql queries from users

Now what i thought was if there was a way for php to store inbound data in memory and subsequently writing it to database via batch inserts , lets say when data reaches 100 items

Is this possible with memcached ? if yes how ? are there any other solutions for this ?

Edit : the chat app is not a web application ,开发者_Go百科 its for an android application


I ended up using a persistant mysql connection and storing data in mysql MEMORY table. , if anyone has a better solution kindly post

Update:

I am now using apc (Alternative PHP Cache) to store the inbound data (in the form of a simple array) , then putting the data in mysql with batch inserts after a number of queries

for GET requests i append the data in apc to the data fetched from mysql.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜