Y
Y
yiicoder2015-02-16 02:14:34
PHP
yiicoder, 2015-02-16 02:14:34

What is the best way to organize database synchronization in PHP+Apc+Mongo?

The application has a very large number of records in the database - so that mongodb can no longer cope.
APC read cache didn't help much.
We want to do both writing and reading from APC, and write data to mongodb "periodically".
Now we did it through a script on the root - we notice that data is sometimes lost, and the solution looks so-so.
How else can you organize data transfer to the database?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
index0h, 2015-02-16
@index0h

I understand correctly, you are trying to use the DB as a cache?
If you need a cache - why are you surprised that data is lost? This is quite a normal situation, I would recommend looking towards memcached / redis, apc is still better for storing opcodes.
If you need a database, either shard it, or optimize the stored data, or pump the cache to the level "the database does not touch at all for reading."
The solution is not bad for the synchronization task:
1. There is a queue (or list) under rabbitmq, or any other queue manager.
2. At any change in data in the database, a message about this is written to the queue.
3. Dependent servers are constantly listening for handlers that perform actions recorded in messages from queues.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question