Home  >  Article  >  Backend Development  >  How php solves big data

How php solves big data

王林
王林Original
2019-09-21 17:58:155287browse

How php solves big data

PHP solves big data

1. Use cache

1. Use program to save directly into memory. Mainly use Map, especially ConcurrentHashMap.

2. Use the caching framework. Commonly used frameworks: Ehcache, Memcache, Redis, etc.

The most critical question is: when to create the cache and its invalidation mechanism.

For the buffering of empty data: It is best to save it with a specific type value to distinguish between empty data and uncached states.

2. Database optimization

1. Table structure optimization

2. SQL statement optimization, syntax optimization and processing logic optimization. Can record the execution time of each statement, targeted analysis

3, partition

4, sub-table

5, index optimization

6, use Stored procedures replace direct operations

3. Separate active data

For example, users can be divided into active users and inactive users.

4. Batch reading and delayed modification

1. In high concurrency situations, multiple query requests can be merged into one.

2. High concurrency and frequently modified files can be temporarily stored in the cache.

5. Read-write separation

Configure multiple database servers and configure master-slave databases. The master database is used for writing and the slave database is used for reading.

6. Distributed database

Store different tables in different databases, and then put them on different servers. Some complex problems, such as transaction processing and multi-table query.

7. NoSql and Hadoop

1. NoSql, not only SQL, does not have as many restrictions as relational databases, and is more flexible and efficient.

2. Hadoop divides the data in a table into multiple blocks and saves them to multiple nodes (distributed). Each piece of data is stored on multiple nodes (cluster). Clusters can process the same data in parallel and ensure data integrity.

The above content is for reference only!

Recommended tutorial: PHP video tutorial

The above is the detailed content of How php solves big data. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn