1- If a flat file can be useful: A flat file can be faster than a database, but in very specific applications. They are faster if data is read from start to finish without any search or writing. If the data does not fit into memory and must be fully read in order to complete the task, it may be faster than the database. In addition, if there are many letters than reading, then a flat file will also be close, most database settings by default will have to make read requests wait for write completion to support indexes and foreign keys. Writing requests is usually slower than just reading.
TD / LR vesion: Use flat files for a job-based system (Aka, simple log analysis), and not for web search queries.
2- Flat files: If you go with a flat file, you will need to synchronize your scripts when the file is modified using the user lock mechanism. This can lead to a slowdown, corruption to a deadlock, if you have a mistake.
Database based Ram based databases? Most databases have query results in the cache, search indexes, which makes them very difficult for bits with a flat file. Since they are cached in memory, making it fully run from memory, most of the time is inefficient and dangerous. It is better to configure the database configuration correctly.
If you want to optimize performance with ram, I would first look at running your php scripts, html pages and small images from the ram drive. If the caching mechanism is more likely, it will be rude and will systematically manage the hard disk for unchanging static data.
An improved result can be achieved with the help of a load balancer, clustering with connecting the back plane to the bar-based SAN array. But that is the whole topic.
5- can several scripts connect to the same database at the same time?
Yes, its called a connection pool. In php (client side), its function opens a connection to its mysql-pconnect ( http://php.net/manual/en/function.mysql-pconnect.php ). I think you can configure the maximum open connection in php.ini. A similar setup on the server side of mysql determines the maximum number of concurrent client connections in the /etc/mysql/my.cnf file.
You must do this in order to take advantage of the processor's parallel process and avoid the php script to wait for each request to complete. This greatly increases productivity under heavy load.
There is also one connection pool / thread pool in the Apache configuration for regular web clients. See Httpd.conf.
Sorry for the text wall, it was boring. Louis.