开发者

How to Measure a Web-Apps need for scalability

I'm building a web app which will serve content to a constantly growing user base. I'm wondering where to start with scalability, and how to measure the performance of my app, so i know when it's needed.

For example, I understand that as traffic to a si开发者_运维百科te grows, things like minifying scripts and using caches for static content will help manage load times, but I'm not sure when the right time is to implement these features.

Additionally, how can I measure the performance of the site, to know when it's time to start adding more servers,and building out the robustness of the app, etc - before my servers start crashing and choking?

Thanks in advance...


Minifying scripts and caching content is something you should do right away. It affects page load speed and thus user experience regardless of how loaded your site is. Research shows that faster websites have better conversion rates - Google it. Page speed is also purportedly good for search engine ranking.

You can measure page load performance using tools like Google Page Speed and Yahoo's YSlow. Both tools also suggest methods for improvement, so let them be your guides.


I more in the coding thing than server admin.. just an idea... I would have a index1.php that would not differ from index.php except it would have a microtime() in the begining and an other one in the last line (or around some piece of code you are suspicious about) to count execution time. After the last line(microtime) I would have a function to store this execution time along with the date in a db.

I would run the page form index1.php 2 or 3 times each day and would store maxtime for that day. At the end of the week you can generate a chart or see the values directly how do they change in accordance to time so you can decide what to do.

mysql optimzation (usually there is a lot of stuff to be optimized, datatypes, indexes, sql queries etc), good design, heavy loops, asynchrnous loading (XmlHttp- can help a lot) all are things to consider.


  1. Start by defining a service level that you want to provide your users. For example, any page should never take more than 1 sec to load from a users perspective. The site should have 99.9% uptime, etc.

  2. Based on the service level, define acceptable performance (in page load times, etc).

  3. Benchmark existing performance. ie measure your current performance on different criteria at current usage level.

  4. Identify pages that you want to optimize. If most of the site needs optimization, you want to look at overall solutions (eg: minifying js/css, caching, etc). If specific pages need optimization, look at individual queries, etc.

  5. Measure performance periodically to see if your service level is still met or you need to scale further.

These are the general steps you can take. As far as specific steps, consider:

  1. Partitioning/ splitting of everything (databases, multiple webservers, etc).

  2. Asynchronous design (ie any process you thing can take a lot of resources, you should convert into an asynchronous process. Say you allow users to upload a document. The app then takes the doc. and does some processing on the doc. Instead of doing all the processing on the single php page, add the request to a queue, then let the user know immediately that his request is queued. Have a separate background process do the processing by looking at the queue. Once complete, you can let the user know that his request was processes.

For more guidelines, you may want to check out a book called "The art of Scalability" http://amzn.to/oSQGHb

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜