We all know that meteor.com is placed on Meteor. You may notice that it loads very quickly. Also, it does not have a loading process - after the HTML is built, the page is immediately displayed on the screen. ')
But how is this possible? Usually, it takes some time - connecting to the server, receiving data and displaying information on the screen. Maybe Meteor uses some kind of magic with the Galaxy? Hm Not. Nothing like this. They cheated a little and meteor.com does not receive data from the server via DDP. I'll show you what they did.
The image shows a list of templates that meteor.com contains. For each page there is a corresponding template that provides output to HTML. So, we don't need to get anything from the server, everything is already here. Although not suitable for thousands of pages, this clever trick shows how they solved the problem with the high load on meteor.com.
There are no subscriptions or methods that access the server. So, this solution will perfectly cope even with a huge number of clients. If they added a caching proxy on meteor.com, then, technically, there is no load on the meteor.com server at all.
How does Meteor do it?
I’m not sure that it’s done the same on meteor.com, but I’ll show you how you can do this very simply and without hacks.
First, install the showdown package with the meteor add showdown .
Secondly, install iron-router , which will help us with routing.
So we create a blogPost using a template.
<templatename="does_meteor_scale"> {{#markdown}} # Does Meteor Scale? Most people who consider Meteor for a production deployment spend time wondering if Meteor can scale. Some say Meteor is a good framework for prototyping, but not for production. After you read this article, you will be able to decide for yourself. ... {{#markdown}} </template>
Now we have a template called does_meteor_scale , which will be used to generate HTML using Template.does_meteor_scale();
If you like digging through the code, then it is available on GitHub .
This method is neither the best nor the easiest way to make a blog. But I want to show that this is possible with Meteor. If we are lucky, someone will find an easy way to put together some of the things that I showed in some package.
In conclusion, I want to add that scaling is as much art as science. You need to know where and when to use the right tactics to get the most elegant and effective solution.