While I can find the answer to almost any specific question I have concerning PHP + MySQL development, one resource I haven’t been able to find is good solutions to advanced problems.
I want to implement a minor messageboard type system that can be queried by AJAX, but it I have too many specifications for it to be filled by a prebuilt library, and I don’t need a tutorial about how to implement and use a database.
What I’m looking for is a resource that provides good solutions to advanced users for more complicated problems than “store a message and print the last 10 messages”-style tutorials.
For example: My website will have group pages each with any number of users, and the private group page will have a small “wall”-like message board. What should I take into consideration when designing this particular table? How should I implement locking? Etc.
Of course, I don’t expect there to be a tutorial for my exact problem, but I would like perhaps a complete solution to a db-driven website that can be comprehended (unlike WordPress – a little too spread out) and that actually works (unlike the full-solutions you sometimes find at the back of a reference book).
I am a .net guy so I will stay generic is my solution. I don’t think the solution you need is language specific any ways. What you need to look into is design patterns and enterprise methods for doing certain things. The key for your success doesn’t come (entirely) via database implementation but what and how you use the data. To scale you need to be able to write quickly (write to a queue instead of to the db) and read quickly (read from a cache layer when possible instead of the db) and search quickly (search from a Lucene index instead of the db). Many people get hung up on the db and they are generally correct in doing so. It is the central part of your applications data storage and querying. But it is also usually one of the single biggest bottle necks in any system. Sure, store all your data to the db, just don’t do it directly. Sure, read and query your data from the db…but only when absolutely necessary (use an index to locate the data, then just read the data from the database).
The same goes when having your application speak with external services. Take the sending of an email for example. Rather than sending the email by connecting to the SMTP server and packaging and sending the email…stick the message into a queue and create a queue reader to connect to and send the email via SMTP. This way your web app continues running smoothly.
The key to your success is performance oriented research and good architectural design. Look up things such as domain driven design, inversion of control, test driven development, repository pattern, model view controller, memcached, velocity, queue, MSMQ, database mail queue, etc.