Techniques for writing a scalable website

后端 未结 10 1011
生来不讨喜
生来不讨喜 2021-02-01 10:15

I am new in the website scalability realm. Can you suggest to me some the techniques for making a website scalable to a large number of users?

相关标签:
10条回答
  • 2021-02-01 10:58

    You might want to look at this resource- highscalability.com.

    0 讨论(0)
  • 2021-02-01 11:06

    Develop your site using solid OOP techniques. You will need your site to be modular as not all performance bottlenecks are obvious at the start. Be ready to refactor parts of your site as traffic increases. The first sentence I wrote will help you do it more easily and safely. Also, use test driven development, As refactor means new introduced bugs, and good TDD is good in catching them before they go into production.
    Separate as much as possible client side code from server side code, as they will likely to be served from different servers, if your site traffic justify this.
    Read articles (read the YSlow tips for instance).

    GL

    0 讨论(0)
  • 2021-02-01 11:07

    In order of importance:

    1. If you run PHP, use an opcode cache like APC. (This is important enough to be built-in in the next generation of PHP.)

    2. Use YSlow or Google Page Speed to identify bottlenecks. (This will reveal structural problems with your website that affect both client and server performance.)

    3. Ensure that your web server sends a proper Expires header for static content (images, Javascript, CSS), such that the browser can cache it properly. (YSlow will warn you about this, too.)

    4. Use an HTTP accelerator, such as Varnish. (This picture says it all – and they already had an HTTP accelerator in place.)

    0 讨论(0)
  • 2021-02-01 11:08

    The biggest problem for scalability is usually shared resources like DBMS's. The problem arises because DBMS's usually have no way to relax consistency guarantees.

    If you want to increase scalability when you use something like MySQL you have to change your schema design to relax consistency.

    For instance, you can separate your database schema to have your normalized data model for writes, and a replicated read only denormalized part for the 90% of read operations. The read only data can be spread over several servers.

    Another way to increase scalability of a database is to partition the data, e.g. separate the data into a database for every department and aggregate them either in the ORM or in the DBMS.

    0 讨论(0)
提交回复
热议问题