Wednesday, January 21, 2015

The cheatsheet on writing scalable web apps

  1. Scale horizontally (scale out): Separate system tiers on different environments: database, Solr, memcached, push, web/app servers. Separation helps in scaling up/down tiers individually.
  2. Use the cloud (Platform as a Service) right away that facilitates scaling out/up/down (Google AppEngine, Heroku, AWS Beanstalk, …
  3. Monitor usage on each tier to scale up/down in the correct time (e.g. NewRelic)
  4. Use push instead of server polling (Pusher)
  5. Don’t use filesystems for storage, unless it is a distributed filesystem (AWS S3)
  6. Don’t involve your app server in long requests/responses. Slow clients may block your server and cause longer request queues (depends on implementation). 
    • If you want to receive an upload get it through S3 with some work on the client side. 
    • If you want to send a huge response, either stream it using a streaming capability of your app server, or generate it using a background job that stores it finally on S3 and sends the direct link when done through the app using push or through email.
  7. Defer long tasks to background jobs (Resque, RabbitMQ, Ruby delayed jobs, …)
  8. Don’t clutter your app server memory with language bindings, use Apache Thrift or Google Protocol Buffers to communicate between different environments
  9. Use Apache Solr (Lucene over HTTP) to query large data even if you don’t have full text search, it can be used for scoping and faceting as well (think SQL WHERE and GROUP BY)
  10. Autoscale your web/app servers depending on traffic. Monitoring shows you traffic metrics and HireFire will autoscale your heroku dynos
  11. Use clients-side rendering (Javascript templates) to get rid of the rendering time on the server
  12. Use caching in different layers (memcached) to be nice on your servers
  13. Asset hosting, static assets (javascripts, stylesheets, html templates, images, …) have nothing to do with your app servers so host them somewhere else (CloudFront/S3)

31 comments:

Robert said...

I stumble upon your post and found many interesting and useful information! thank you san jose website designer

Robert said...

Customize with easysite.com' free website builder, no coding skills needed. Choose a design, begin customizing and be online today! web hosting in Nigeria

Unknown said...

Processing of business operations has become easier with Android app development. With a surge in BYOD (Bring Your Own Device) strategies, it has become more important for the businesses to adopt Android app developments. Android App Development has helped enterprises of all sizes create customized solutions to cater to the specific business needs and demands.xposed installer apk

Unknown said...

Great article Lot's of information to Read about web hosting. Windows hosting always rock. I highly recommend shared hosting ...Great Man Keep Posting and update to People..Thanks

historypak said...

It was a very good post indeed. I thoroughly enjoyed reading it in my lunch time. Will surely come and visit this blog more often. Thanks for sharing. Ultra-Web

Anna Schafer said...

I have checked this link this is really important for the people to get benefit from.
web hosting in Nigeria

Anna Schafer said...

therefore, I would like to thank you for the efforts you have made in writing this article.
Find the best internet marketing solutions

gunardi said...

I feel this is among the such a lot vital info for me. And i am satisfied studying your article. However wanna commentary on few general things, The website style is ideal, the articles is truly nice
Tangki Panel

Linda said...

I just found this blog and have high hopes for it to continue. 메이저놀이터

Unknown said...

very nice blog post, i certainly like this web site, go on it 메이저놀이터

godok said...

사설토토 blog was incredible, I'm glad that i found this type of site, after so many hours of searching of a marvelous site like yours.

godok said...

all bloggers offered the same content as you, the internet would be a far better 토토사이트 place this amazing post Click the link below

godok said...

play a very important role in staying in touch with clients, delegates, and fellow employees 보증업체Thanks a lot. Anyhow, click this site

blue said...

I look forward to your kind cooperation.Thank you. I'll be back every time 토토커뮤니티

blue said...

The registered guarantor at reliable. Always fighting! 안전놀이터 Cool. I'll be back every day

blue said...

I can grow up with. Please continue to do well and always do well 먹튀검증업체 truly sharing fastidious thoughts

rezadastgozin said...

Het was erg nuttig en geweldig. Publiceer deze inhoud opnieuw.

Als u app laten maken services nodig heeft, kunt u contact opnemen met het Nexoz team.

Door applicatie ontwerpen u bent op elk moment beschikbaar voor klanten.

Door een mobiele app laten bouwen, krijgt u de mogelijkheid om meer te communiceren met en toegang te krijgen tot uw klanten.

donggle said...

Wow, great blog article this web site is genuinely nice and the people are 먹튀보증업체

donggle said...

I'll come and read every day. It's really nice to have a place like this 안전카지노 You’re incredible! Thank you!

토토사이트 said...

Just admiring your work and wondering how you managed this blog so well 스포츠사이트 It’s so remarkable thato through this valuable information

토토사이트 said...

This blog was 안전공원 how do you say it? Relevant!! Finally I've plus efficient information and facts, hence notice it: coryxkenshin merch

토토사이트 said...

Thank you very much for all your proposals on this site your work and wondering how you managed this blog so well. It’s so remarkable 토토사이트 thato through this valuable information

Deny2deny said...

بسیار محتوای مفیدی بود. ممنون از اینکه این گونه مطالب رو به اشتراک می گذارید.

هنگامی که نوبت به یافتن یک شرکت تعمیر لوازم خانگی می رسد، دو سوت تعمیر کلیه شرایط را دارد.

ما اطمینان حاصل می کنیم که فقط از افراد متخصص و واجد شرایط استفاده کنید که می توانید به آنها وابسته باشید.

ما با ارائه ضمانت در کلیه قطعات و تعمیرات در پشت متخصصان خود ایستاده ایم.

هنگامی که دو سوت تعمیر را برای سرویس و یا تعمیر لوازم منزل خود انتخاب می کنید، کاری می کنیم که از تصمیم خود اطمینان داشته باشید.

ally said...

Hi friends, how is the whole thing, and what you wish for to say on the topic of this article, in my view its really amazing in support of me.
카지노

wep.

Deny2deny said...

متشکریم از به اشتراک گذاری.

در صورت نیاز به خدمات طراحی گرافیک، تبلیغات و یا طراحی و توسعه می توانید به تیم ریوال ایجنسی اعتماد کنید.

مهمترین هدف مجموعه ریوال ایجسنی تامین نیازهای قسمت های مختلف گرافیکی و تبلیغاتی در سطح بین الملل در داخل کشور می باشد.

ریوال ایجنسی با سابقه ای درخشان و با در اختیار داشتن کادری مجرب و حرفه ای در عرصه گرافیک و تبلیغات آماده همکاری با شرکت های داخلی و خارجی می باشد.

yahanvideonet said...

I read this article fully regarding the resemblance of most recent and preceding technologies, it’s amazing article. 야한동영상

yahanvideonet said...

Thanks for the marvelous posting! I certainly enjoyed reading it, you’re a great author. I will ensure that I bookmark your blog and may come back from now on. I want to encourage you to continue your great writing, have a nice day! 일본야동

yahanvideonet said...

I could not resist commenting. Well written. There is certainly a lot to learn about this topic. I love all of the points you have made. 한국야동닷컴

yahanvideonet said...

You are so awesome! I don’t suppose I have read anything like this before. So wonderful to discover another person with genuine thoughts on this issue. Really.. many thanks for starting this up. This site is something that’s needed on the web, someone with a little originality. 국산야동

yahanvideonet said...

Greetings! Very useful advice within this article! It’s the little changes that will make the biggest changes. Thanks for sharing! 중국야동넷

Unknown said...

This site seems to inspire me a lot. Thank you so much for organizing and providing this quality information in an easy to understand way. I think that a healthy era of big data can be maintained only when such high-quality information is continuously produced. And I, too, are working hard to organize and provide such high-quality information. It would be nice to come in once and get information.

Also visit my site:먹튀검증