|
Recently, I interviewed several companies one after another, and I recorded some important questions, urging myself to study and improve, and at the same time hoping to give some help to my friends. There is a lot of content, little by little, step by step learning. Some are asked in interviews, some are recruitment requirements, and some are added by themselves.
1. MySQL related knowledge 1. MySQL optimization method MYSQL optimization common methods MySQL performance optimization scheme
2. How to divide the database and tables Reference: http://blog.sina.com.cn/s/blog_6e322ce70100zs9a.html http://www.jb51.net/article/29771.htm 3. How to do dual-machine hot standby and load balancing in Mysql+
http://www.dewen.org/q/51/Mysql+如何做双机热备和负载均衡
4. What are the types of data tables? MyISAM, InnoDB, HEAP, BOB, ARCHIVE, CSV, etc MyISAM: Mature, stable, easy to manage, fast to read. Some features are not supported (transactions, etc.), table-level locks. InnoDB: Supports transactions, foreign keys, and row locks. It takes up a lot of space and does not support full-text indexing. Key features of the myisam and Innodb engines: What is the difference between MySQL's storage engine MyISAM and InnoDB? 5. Anti-SQL injection method mysql_escape_string(strip_tags($arr["$val"])); 6. How to solve the cross-table query efficiency problem after mysql splits a large table into multiple tables [php] view plain copy View code slices derived from my code slices on CODE /** * Function Name: post_check() * Function function: Processes the submitted edits * Parameter: $post: The content to be submitted * Return Value: $post: Returns filtered content */ function post_check($post){ if(!get_magic_quotes_gpc()){// Determine whether the magic_quotes_gpc is open $post = addslashes($post); Perform magic_quotes_gpc filtering of submitted data without opening } $post = str_replace("_","\_", $post); Filter out '_' $post = str_replace("%","\%", $post); Filter out '%' $post = nl2br($post); Enter conversion $post = htmlspecialchars($post); html markup conversion return $post; } 7. Index application When to consider indexing What situations are not suitable for indexing How to judge whether a statement uses an index Frequent scenarios where indexes are not used: like '%.....' Implicit conversion of data types or keywords plus other conditions Full Text Index: Can only be used for MYIsAM tables, created on columns of type CHAR, VARCHAR, TEXT.
8. How to optimize mysql for large tables (tens of millions)? Reference http://www.zhihu.com/question/19719997 9. Slow query problem of mysql In fact, it is a relatively simple way to analyze through slow query logs, if you don't want to see the logs, you can use tools to complete it. Such as mysqldumpslow, mysqlsla, myprofi, mysql-explain-slow-log, mysqllogfilter, etc., feel like you need a lot of experience to analyze one, and a waste of time. 10. Regarding the advantages and disadvantages of user login status session, cookie, database or memcache http://www.dewen.org/q/11504/ Regarding the user's login status, the advantages and disadvantages of session%2Ccookie, database, or memcache 11. Extreme cases are handled in transactions 12. SQL language is divided into 4 categories, please list DDL--CREATE,DROP,ALTER DML--INSERT,UPDATE,DELETE DQL-SELECT DCL--GRANT,REVOKE,COMMIT,ROLLBACK
2. PHP basics session Several ways and differences between PHP connecting to MySQL databases mysql: process-oriented mysqli: object-oriented PDO: High portability Please refer to: PHP Basic Series: Three APIs Used by PHP to Connect to MySQL Databases 3. PHP Advanced Use of long and short connections socket Payment security issues Object-oriented Three major characteristics: encapsulation, inheritance, and polymorphism (method rewriting). Abstract class: abstract, at least one method is an abstract method that cannot be instantiated, defining a common interface for the subclass. Interface: interface, solve the single inheritance problem of PHP, all methods are abstract methods of public access, you can't declare variables, only constants. Inherit a class while implementing multiple interfaces class A extends B implements interface 1, interface 2..., interface n() { Implement methods in all interfaces } Analysis of the causes of differences in performance between LAMP and LNMP website architectures Performance analysis of interpreted and compiled languages, examples. 4. Regularity email, html, js, etc. matching 5. Development foundation Process and thread definitions, distinctions and connections. The state of the process: run, ready, wait 6. Nosql database Memcached, redis, mongodb differentiated connections 3 scenes completely different things. 1.memcached: If a single key value is cached in memory, there is no substitute for object caching distributed cache; 2. redis: It is a collection of algorithms and data structures, fast data structure operation is its biggest feature, supporting data persistence; 3. MongoDB is a BSON structure, between RDB and NoSQL, which is looser and more flexible, but it does not support transactions and is only used as a non-important data store. Can I refer to MongoDB or redis as an alternative to memcached? 7. Commonly used Linux commands For example, soft links 8. Architecture related Stress test before the project goes live, the number of concurrency supported by a single server, and the number of PVs. Reasonable allocation of server resources CPU:Apache In a high-load environment, too many disk IO reads and writes will definitely take up a lot of resources, and the CPU will inevitably take up too much CPU. Memory: Memory bank, database software
Hard Drive: Files web2.0 architecture selection MongoDB+Redis or MySQL+Memcached is a better combination, and NOSQL is used for simple logic The main website architecture is currently popular LAMP、LNMP、LLMP Now there is also an LNAMP architecture on the network, that is, it combines the advantages of nginx and Apache, using Apache to load PHP, nginx is responsible for parsing other web requests, and uses nginx's rewrite module, but the Apache port is not open to the public, and many modules of Apache can reduce resources without loading. |