Applicability of Meteor Web Framework in Social Networking Sites

Applicability of Meteor Web Framework in Social
Networking Sites
Prasad Karanjkar, Ketankumar Juneja, Saurabh Kadam,Amit Kolambikar, Prof. Smita Chaudhari
Department of Computer Engineering, International Institute of Information Technology,
Hinjewadi, Pune
Abstract—The users of social networking are increasing
exponentially and the demand for better user experience is ever
increasing. Many web technologies are being used to meet these
increasing demands. Meteor Web framework provides tools and
features which enable better user experience with minimum
utilization of user resources. Besides the basic needs other
important features such as real time processing are addons meteor
web framework provides.
Keywords— Latency Compensation, Performance, Publications
and Subscriptions, Reactivity, Sync and Async, Templates..
I. INTRODUCTION
In this paper we have presented a detailed study of different
aspects of meteor web framework and their applications in
social networking web aplication.The current user demands
speed and minimum utilization of resources in the applications
they use. Social networking applications demand lesser loading
time which leads to user spending less resources on getting
what is needed. Besides scalability across multiple users is also
an important aspect as the number of users across the world is
ever increasing. Reactivity and clickablity are also important
pillars of a social networking application. The major concern of
a social networking application is the user privacy and data
security. All the above necessities and short comings of a social
networking application can be satisfied with the use of Meteor
web framework.
REQUIREMENTS OF A SOCIAL NETWORKING SITE
Before understanding the advantage of meteor web
framework we must understand the need of a social networking
application.
 Connectivity - The prime object of a social
networking application is being able to interact with
the community. It includes profile management of
users and searching abilities to connect with other
users.
 Real time information sharing - Social networking
application provides a platform whereby
information can be shared in real time. This
includes features like discussion forum messaging
groups etc.
 Media sharing - Multimedia finds its applications
across
multiple
domains
ranging
from
entertainment
to
education,
technological
advancements to advertisements etc.
II.



Latency - The social networking should aim to
reduce latency time to minimize the time wasted by
the user, waiting for response.
Consistency – Todays user performs web activities
across various platforms (mobiles, desktops, tablet
etc.). A consistency must be maintained across all
the platforms.
Scalability - Social networking application must
have the ability to adapt to increasing traffic and
encompass the new users.
III.
ASPECTS OF METEOR WEB FRAMEWORK
Important aspects of meteor help to meet the above outlined
requirements of a social networking application. They are as
follows.
A. Latency Compensation - latency is the time required for
the cause to generate an effect. Conventional web
frameworks are infamous for their higher latencies.
Comparatively speaking a web form interface built using
conventional
frameworks
would
follow
the
undermentioned flow [1].
1. User submits form.
2. Send a post to the server via AJAX.
3. Wait for response from the server.
4. Add the new post to the list.
The above procedure might require user to wait for long
time depending upon the connection speed and response
time. This increased waiting time hampers user experience
which is an important aspect in a social networking
application. Meteor compensates for this in the following
way.
1. User submits form.
2. Call Posts.insert ().
3. Simulate the results of that insertion on the client.
4. Use the result of the simulations to add the new
post right away.
5. Get response from the server.
6. If we got the simulation wrong, correct the
mistake.
The above procedure can successfully accomplished by
inserting the post in a database. Meteor can store a subset
of the database on the client, it can perform operations
against it and get a fairly good idea of what the result would
look like on the server [1].
B. Performance – One of the main challenges in any real
time web application is scalability. Scalability depends
upon the kind of application that is being built and
specifically how it manages the data. The fundamental
differences between the traditional, single-page, and realtime web applications given below.
 Traditional Web Applications
In a traditional application, each time a user
accesses a new page on the site, the client (i.e. the
browser) makes a request to the server and gets
content (typically an HTML file) back in return
[2].
client request more data, but the server can also
push data to the client (for example, when that data
has changed in the database) [2].
Fig 3. A real-time web application.
Fig.1. A traditional web application.

Single-page Web Applications
In a single-page application, the initial request to the
site downloads a single JavaScript file containing
all the code needed to render every page. Separately,
the app will also make requests for the raw
data (usually in a lightweight format like JSON) to
fill in each page [2].
Fig 2. A single-page web application

Real-time Web Applications
Finally,
in
a real-time,
single-page
application (such as a Meteor app), not only can the
Another main advantage of meteor here is its ability to
instantly know whenever the data has changed. It uses a
mechanism called poll-and-diff for this purpose. A simple
publication code is given below to understand the above
concept.
Meteor.publish('posts', function() {
return Posts.find();
});
When the above code is published cursor, and a user first
subscribed to it, a LiveResultsSet (LRS for brevity) is
established. A LRS is the mechanism that Meteor uses to
poll the database. At this point, it’s important to remember
that while data changes will usually happen through the
Meteor app itself, it’s also possible for external data
changes to occur. These could be triggered by another
instance of the same app (when scaling horizontally), a
different app altogether, or even manual changes to the
database through the Mongo shell. So every 10 seconds (or
whenever the server thinks that the Posts collection may
have changed), the LRS will re-run the Posts.find() query
against Mongo (with a corresponding hit to your Mongo
server). With the latest release of the Meteor framework
new database monitoring technique Oplog tailing has
developed. Oplog tailing does away with the LRS' polland-diff dance. Instead, Meteor uses the Mongo Oplog (a
feed of data that’s intended for synchronizing a Mongo
Replica Set) to make Mongo a “pseudo-realtime” database.
Mongo is a true real-time database, it sends out
the added/changed/removed messages needed by Meteor
for every query requiring real-time updates, and there
would be far less work needed on the server to in turn
transmit these changes to the client.
C. Publications & Subscriptions - The way in which meteor
handles the applications data is one of the very important
asset of meteor. Earlier, before the meteor existed, when a
user would visit the site, first job of the client was to send
the request to application which was present on the server.
It was then the applications job to figure what type of data
user needs to see. Instead, the meteor uses a client side
component which is located on client machine (browser).
This architecture lets Meteor do various interesting things.
Chief among them, what meteor calls simply put. Meteor
will take a subset of your database and copy to the client.
various tasks on the client browser through the event
handlers. This mechanism is a single threaded mechanism
which handles crucial tasks one at a time. If there are more
than one event handlers which are to be triggered on the
click of same button then the second event handler has to
wait until the first one completes its operation and informs
the second one about its completion. This kind of tasks are
called as synchronous tasks. When the tasks need long time
to run asynchronous functions come into action. An
asynchronous task can be initiated without locking the
browser (waiting for server to respond for a particular
request). System performs the execution of tasks
continuously so as to complete the list of the given tasks
asynchronously. Event loop concept is used to arrange the
tasks in an order in which they are to be executed
asynchronously [5]. On the client side asynchronous code
usually takes the form of Ajax. Ajax is most commonly
used through a jQuery wrapper. On the server, the Node.js
runtime is single-threaded as well. But in Node.js, one may
come across many more asynchronous operations: calling
APIs, reading and writing files, executing operations on
F.
Fig 4. Pushing a subset of the database to the client .
This has two big implications: first, instead of sending
HTML code to the client, a Meteor app will send the
actual, raw data and let the client deal with it (data on the
wire).Second, you’ll be able to access that data
instantaneously without having to wait for a round-trip to
the server. And what’s even cooler is that Meteor will also
do all the heavy lifting of keeping the client and server data
in sync (latency compensation). For security reasons the
entire database is not mirrored at the client site [3]. Only
the required data at that instance is made available at the
client side. Meteor also helps in filtering of data to be
published on the client side. Data filtered has no way to be
visible on the client side at all[3]. If a particular set of data,
client is interested in then the data is subscribed by the
client. Only the subscribed data is mirrored by the server
on the client side (i.e on mini mongo). One of the benefits
of building Meteor applications is that user don’t have to
worry about client-server APIs, since Meteor’s built-in
collections handle synchronizing data to the browser for
the user.
D. Reactivity - Meteor makes it possible to make a JavaScript
object reactive (in other words transforming it into
a reactive data source) [5]. Reactive here states that,
whenever there is any change in the internals of object it
notifies user.
Reactive computations (also known as reactive contexts)
are used to capture the notifications if the object notifies
about ant internal changes.
E. Sync and Async - JavaScript is used to provide
interactivity i.e on click of a button, triggers a bit of
JavaScript code (known as an event handler function), and
an alert pops up. Javascript is responsible for carrying out
the server, etc.
Templates - Meteor parses all of the HTML files in your
application folder and identifies the three top-level
tags: <head>, <body>, and<template>.Everything inside
any <head> tags is added to the head section of the HTML
sent to the client, and everything inside <body> tags is
added to the body section, just like in a regular HTML file.
Everything inside <template> tags is compiled into
Meteor templates, which can be included inside HTML
with {{> templateName}} or referenced in your JavaScript
with Template.templateName. All of the code in your
HTML files is compiled with Meteor's Spacebars
compiler. Spacebars uses statements surrounded by double
curly braces such as {{#each}} and {{#if}} to let you add
logic and data to your views.You can pass data into
templates from your JavaScript code by defining helpers.
In the code above, we defined a helper
called tasks on Template. Body that returns an array.
Inside the body tag of the HTML, we can
use tasks}} {{#each to iterate over the array and insert
a task template for each value. Inside the #each block, we
can display the text property of each array item
using {{text}}. Iron Router is the main routing package for
Meteor, and it includes powerful features for setting and
manipulating data contexts through its data function.
Setting the data context in the router means user don’t need
to do it in the template. Which in turns makes it much
easier to reuse your template for different data contexts.
The data contexts are also very important when dealing
with their JavaScript counterpart, template helpers. In a
template helper, the data context is accessible through the
“this” keyword. It’s also important to note that a template
helper will inherit its data context from the template itself.
Static and dynamic templates bot are favorable in their own
ways [6]. Static templates are the templates which we
normally use. Dynamic template includes are also another
good way to make the application more flexible and
promote code reuse.
IV. CONCLUSION
Study makes it evident that Meteor framework features are
the most suitable for development of a social networking site.
These Meteor web framework features provide efficiency for
resource management, time management, latency reduction etc.
The major principle of meteor framework is javascript end to
end which makes it possible for the client to simulate server
operations on the client by executing the same instruction on
both client and server side. Scalability is the most important
aspect of real time application. Meteor is server intensive which
enable real time scaling.
ACKNOELEDGMENT
We are using this opportunity to express our gratitude to Mr.
Sanjay Shinde who have guided us regarding matters where we
needed clarity about the subject. We are thankful for their
aspiring guidance, invaluably constructive criticism and advice
during the course of this study.
REFERENCES
[1] Stefan Tilkov, Steve Vinoski “Node.js: Using JavaScript to Build High
Performance Network Progams” IEEE computer society.
[2] Tom Coleman, Sacha Greif “Discover Meteor: Building real time
JavaScript web apps”.
[3] Stephan Hochhaus, Manuel Schoebel “Meteor in Action”.
[4] Arvid Heise, Astrid Rheinländer, Marcus Leich, Ulf Leser, Felix
Naumann “Meteor/Sopremo: An Extensible Query Language and
Operator Model” Technische Universität Berlin, Germany.
[5] Sahand Sadjadee “Meteor framework, a new approach to web
development: an experimental analysis” Institutionen för datavetenskap
Department of Computer and Information Science, LIU-IDA/LITH-EXA--13/067—SE
[6] John A Miller, Devanand Palaniswami, Amit P Sheth, Krys J Kochut,
Harvin Der Singh” WebWork METEOR’s WebBased Workow
Management System” Large Scale Distributed Information Systems Lab
LSDIS, Department of Computer Science The University of Georgia
Athens,GA,30602-7404,URL:http://LSDIS.cs.uga.edu.
Download PDF
Similar pages