Professional Documents
Culture Documents
Seminar submitted to
KAVAYITRI BAHINABAI CHAUDHARI NORTH MAHARASHTRA
UNIVERSITY,JALGAON
In fulfillment of requirement for the award of degree of
BACHELOR OF ENGINEERING
Under the
Faculty of Engineering and Technology
In the discipline
Computer Engineering
By
Koustubh Rajkumar Mishra
T.E. Computer
Guide
Nilesh Choudhary
Profesor
CERTIFICATE
This is to certify that the T.E.Computer Seminar "REAL TIME DATABASE" submitted
by Koustubh Rajkumar Mishra In fulfillment of the degree of BACHELORS OF ENGI-
NEERING in the Department of COMPUTER ENGINEERING, Godavari College of
Engineering, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon is
a bonafide record of work carried out by his in the Department of Computer Engineer-
ing, Kavayitri Bahinabai Chaudhari North Maharashtra University, Jalgaon under my
guidance and supervision. In my opinion this work has attained the standard fulfilling
the requirements of the regulations of the University.
Date:
Place:Jalgaon
Dr. V. G. Arajpure
PRINCIPAL
Godavari Foundation’s
Godavari College of Engineering, Jalgaon
DECLARATION / UNDERTAKING
I hereby declare that the work presented in this Seminar "REAL TIME DATABASE"
was carried out by me under the supervision of guide from January-2019 to April-2019.
This work or any part of this work is based on original research and has not been sub-
mitted by me to any University/Institution for the award of any degree.
Date:
Place: Jalgaon
Special thanks to Prof. Pramod B. Gosavi (Head of Computer Engineering) for the
support and help us in completing this Seminar successfully.
Last but not least; we are thankful to the God, my dearly beloved Parents, all Faculty
Members, my Friends and all who directly or indirectly supported for completion
Abstract 1
1 INTRODUCTION 2
2 Discovery 4
4 FIREBASE 10
4.1 Beyond the marketing copy:- . . . . . . . . . . . . . . . . . . . . . . . 10
4.2 This make lot of sense if they are me But I understand that many of you
are not me, so I am sorry if you were not helped by that. . . . . . . . . . 11
5 FIREBASE HOSTING 15
5.1 Grow your app and retain users . . . . . . . . . . . . . . . . . . . . . . 16
5.2 Google Analytics for Firebase . . . . . . . . . . . . . . . . . . . . . . 17
5.3 Firebase Predictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6 FIREBASE FEATURES 19
i
7 RethinkDB :- 21
7.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
7.2 When is RethinkDB a good choice? . . . . . . . . . . . . . . . . . . . 22
7.3 Who is using RethinkDB in production? . . . . . . . . . . . . . . . . . 23
7.4 Is RethinkDB based on existing technology? . . . . . . . . . . . . . . . 24
7.5 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
8 MongoDB 26
8.1 MongoDB platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
8.2 MongoDB History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8.3 FEATURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
11 DEADLOCK 35
12 CONCLUSION 37
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
ii
List of Figures
4.1 , . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.2 traditional and firebase . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.3 Firebase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
iii
Abstract
The purpose of this study is to introduce everyone with real time databases like Google
firebase API, Mongo DB, Re think DB and their features. Firebase is a Google pro-
vided API for database storage and syncing into your android, IOS or web application.
Rethink DB is the first open-source, scalable JSON database built from the ground up
for the real time web. Mongo DB is a product between relational database and nosql
database which uses distributed technology. A real-time database is one which stores
data to database and fetches data from it very quickly but Firebase is not just a real-time
database, it is much more than that. Mongo DB is non-relational database just stores
data without explicit and structured mechanisms to link data from different buckets to
one another.
Chapter 1
INTRODUCTION
Traditionally, real-time systems manage their data (e.g. chamber temperature, aircraft
locations) in application dependent structures. As real-time systems evolve, their ap-
plications become more complex and require access to more data. It thus becomes
necessary to manage the data in a systematic and organized fashion. Database man-
agement systems provide tools for such organization, so in recent years there has been
interest in database and real-time technology. The resulting integrated system, which
provides database operations with real-time constraints is generally called a real-time
database system (RTDBS) 1. Like a conventional database system, a RTDBS functions
as a repository of data, provides ecient storage, and performs retrieval and manipulation
of information. However, as a part of a real-time system, whose task are associated with
time constraints, a RTDBS, has the added burden of ensuring some degree of condence
in meeting the system’s timing requirements. Example applications that handle large
amounts of data and have stringent timing requirements include telephone switching
(e.g. translating an 800 number into an actual number), radar tracking and others. Arbi-
trage trading, for example, involves trading commodities in di erent markets at di erent
prices.
Since price discrepancies are usually short-lived, automated searching and process-
ing of large amounts of trading information are very desirable. In order to capitalize on
the opportunities, buy-sell decisions have to be made promptly, often with a time con-
2
REAL TIME DATABASE
straint so that the nancial overhead in performing the trade actions are well compensated
by the benet resulting from the trade. As another example, a radar surveillance system
detects aircraft images or radar signatures. These images are then matched against a
database of known images.
The result of such match is used to drive other system actions, for example, in
choosing a combat strategy. Conventional database systems are not adequate for this
type of application. They di er from a RTDBS in many aspects. Most importantly RT-
DBSs have di erent performance goals, correctness criteria, and assumptions about the
applications. Unlike a conventional database system, whose main objective is to 2 Ben
Kao and Hector Garcia-Molina provide fast average response time, a RTDBS may be
evaluated based on how often transactions miss their deadlines, the average lateness or
tardiness of late transactions, the cost incurred in transactions missing their deadlines,
data external consistency (how current the values of data are in reecting the state of the
external world), and data temporal consistency (values of data in the database should
be taken from the external world at similar times) [50]. As a real-time system, speci-
cations related to timing constraints are usually supplied by the application designers.
For most cases, these timing requirements are expressed as deadlines for transactions.
Transactions of this sort, with which explicit time constraints are associated, are termed
real-time transactions. As mentioned above, a RTDBS can be viewed as a value-added
database system that supports real-time transactions.
Discovery
4
REAL TIME DATABASE
scale? In this article, we dissect the real-time query features of Meteor, RethinkDB,
Parse and Firebase to uncover scaling limitations inherent to their respective designs.
We then go on to discuss and categorize related real-time systems and share our lessons
learned in providing real-time queries without any bottlenecks in
6
REAL TIME DATABASE
its value (zero residual value case), it should be dropped to free system resources for
the benet of other transactions. Finally, when a tardy transaction carries negative value,
the system may choose to raise the transaction’s priority so that it can be completed as
soon as possible to diminish the cost incurred due to it tardiness. On the other hand,
the system may lower the transaction’s priority or even drop it so that other transactions
have a better chance of meeting their deadlines.
The decision is dependent upon the application semantics. In the extreme case that
a system cannot a ord having a tardy transaction (e.g. in nuclear power plant control),
the system is said to be a hard real-time database system otherwise, if tardy transac-
tions are tolerated even though they may be undesirable (e.g. arbitrage trading), we say
that the system is a soft real-time database system. It is argued in [51] that with cur-
rent technology, it is very hard to provide an absolute guarantee on meeting transaction
deadlines, and therefore, RTDBSs are mostly limited to soft real-time systems. There
are several factors that make it hard for a RTDBS to meet all deadlines. Firstly, the exe-
cutions of database transactions are usually data and resource dependent. To guarantee
satisfaction of transaction deadlines requires enormous excess resource to accommo-
date the highest system load. Secondly, full transaction support involves many database
protocols which are highly unpredictable in their execution times3
NoSQL Databases:
a Survey and Decision Guidance
Together with our colleagues at the University of Hamburg, we that is Felix Gessert,
Wolfram Wingerath, Steffen medium.baqend.com
Responding to the need for reactivity on the database side, a new class of database
systems have emerged that are natively push-oriented and thus promise to ease devel-
opment of reactive (web) applications. These systems are often referred to as real-time
databases, because they keep data at the client in-sync with current database state in
realtime, i.e. immediately after change.
actions are sporadic with unpredictable arrival times. For example, the system gives an
earlier request deadline to a higher priority and a later deadline to a lower priority.[7]
Below is a comparison of different scheduling algorithms.
FIREBASE
10
REAL TIME DATABASE
Figure 4.1: ,
If you identify as a backend engineer, you might be hearing this and thinking that
your job is being eliminated OMG, no more backendsâĂŁ-âĂŁnow I have to learn
frontend development This is not really true, as there are some things that simply ought
to be on the backend for a variety of reasons. Firebase recognizes this, and offers a way
to do some backend development, where it makes sense for the app you work on. So,
dont worry, your job is safe, and I will talk more about this later on.Anyway, at the time
of this writing, I count 17 individual products in the Firebase suite. Here is another
helpful picture:
Hint: start with Cloud Firestore, as it likely addresses more of your needs (and its
also massively scalable). You can use either one, or both together, if that suits your
app.Its worth noting that Firestore is technically a Google Cloud product, not a Firebase
product. Why is it listed with Firebase? Firebase adds SDKs to use in your mobile
app to make direct data access possible, removing the need for that pesky middleware
component. There are other products listed here with a similar relationship with Google
Cloud, which I will also note.Whats really special about these databases is that they give
you realtime updates to data as it changes in the database. You use the client SDK to
set up a listener at the location of the data your app wants to use, and the listener gets
invoked with that data repeatedly, every time a change is observed. This lets you keep
your apps display fresh, without having to poll the data of interest.With realtime data
like this, our friend Greta uses realtime data in her games to maintain live leaderboards
of in-game events for everyone to see. Shawn uses them to provide messaging between
friends on his social network. Because we just dont have enough chat apps out there!
FIREBASE HOSTING
Is a secure, global web hosting CDN (Content Delivery Network). It is really good at
quickly delivering static content (HTML, CSS, JS, images) using servers that are close
to your users. And you can get it set up quickly, with or without your custom domain,
along with a provisioned SSL certificate that costs you nothing. Firebase Hosting has
one important point of integration with the rest of Firebase, and that is through Cloud
Functions. Firebase Hosting lets you proxy the request and response to and from Cloud
Functions when writing HTTP type functions. And, even better, it will cache the re-
sponses from your functions, if you configure them properly. What a great way to build
a RESTful API
Truth be told, I can not tell you exactly what RESTful means. I am assuming you know.
Feel free to rant in the comments.lets you take advantage of a wealth of machine learn-
ing expertise from Google, without having to know anything about ML. This is great for
me, because I dont know anything about ML But what I get out of ML Kit is the ability
to recognize things that my device camera captures, such as text, faces, and landmarks.
And it can work on my mobile device with very limited computing power. For those
of your with more advanced understanding of ML (again, not me), you can upload a
TensorFlow model for more sophisticated use cases. The roadmap for machine learn-
ing products at Firebase.Shawn uses ML Kit to locate faces in the photos and videos
uploaded by the users of his social network, then he performs some image manipulation
15
REAL TIME DATABASE
on them. Greta doesnt use ML Kit yet, because there is no Unity implementation for the
SDK yet. Dang But if there was, she might use it to let people scan QR coupon codes
for free promotional in-game items.And that is it for the build group. Lots of useful
tools in there! But there is still much left to discuss about Firebase.
• Analytics
• Predictions
• Cloud Messaging
• Remote Config
customize your app without deploying a new version, monitor the changes
• A/B Testing
• Dynamic Links
• App Indexing
• InApp Messaging
the audience members with information and offers of interest to these groups.
FIREBASE FEATURES
1 Authentication: Authentication feature in firebase let you let only authorised users ac-
cess your application. Firebase provides login through Gmail, Github, twitter, facebook
and also let the developer create custom authentication.
2 Hosting: Hosting is production-grade web content that facilities the developers. With
Hosting, you can rapidly and effectively send web applications and static content to a
Content Delivery Network (CDN) with a single command. It contains custom domain
support, Global CDN and Auto Provisioned SSL Certificate.
4 Analytics: This feature enables the application developer to understand how users are
using his application. The SDK capture events and properties on its own and also al-
lows you to get custom data. The dashboard provides details like your most active user
or what feature of your application is used most. It also provides you with summarised
19
REAL TIME DATABASE
data.
5 Storage: Firebase also provides storage facility. It can store and retrieve content like
images, videos and audio directly from client SDK. Uploading and downloading is done
in the background. Data stores are safe and the only authorised user can access it.
6 Real-time Database: Database in firebase is a cloudbased database and does not need
SQL-based queries to store and fetch data. Database is highly reliable thus even if con-
nection is lost data is maintained.
7 Crash reporting: crash reporting feature on firebase creates reports of error in your
app after its release. Errors are grouped into different groups according to how severe
error is. You can also create custom events to catch steps leading to the crashing of the
application.
8 App Indexing: By using this component you easily get to index your application in
Google Search. For an instance, if your application is already installed in users de-
vice when he searches for related content, it will live your app directly from the search
results. If users have not installed your application yet, an install card shows up in
search results. 9. AdMob: It is a simple approach to adapt mobile apps with focused
in-application promoting. It is mobile advertising platform which you can use to create
revenue with the help of your application. It gives you extra application usage informa-
tion and analytics capabilities.
RethinkDB :-
21
REAL TIME DATABASE
updates. The website, GitHub organization, and social media accounts will also con-
tinue operating. The interim leadership team will work with the community to establish
formal governance for the project. Under the aegis of The Linux Foundation, the project
has strong institutional support and the capacity to accept donations. Over the past sev-
eral months, members of the community have expressed interest in making donations to
fund ongoing RethinkDB development. We are now equipped to accept those donations
and put the money we raise to good use. Stripe has generously agreed to match up to
$ doller25,000 in donations. You can donate here to support RethinkDBs future as an
open-source project.
7.1 History
RethinkDB was founded in 2009, and open-sourced at version 1.2 in 2012 [5]. In
2015, RethinkDB released version 2.0, announcing that it was production-ready.[6] On
October 5, 2016, the company announced it was shutting down, transitioning members
of its engineering team to Stripe, and would no longer offer production support.[7][8]
On February 6, 2017, The Cloud Native Computing Foundation purchased the rights to
the source code and relicensed it under the Apache License 2.0.
• Multiplayer games
• Realtime marketplaces
• Connected devices For example, when a user changes the position of a button in a
collaborative design app, the server has to notify other users that are simultaneously
working on the same project. Web browsers support these use cases via WebSock-
ets and long-lived HTTP connections, but adapting database systems to realtime needs
still presents a huge engineering challenge.RethinkDB is the first open-source, scalable
database designed specifically to push data to applications in realtime. It dramatically
reduces the time and effort necessary to build scalable realtime apps.
• Jive Software and Mediafly use RethinkDB to power reactive web and mobile apps
• Pristine.io and Narrative Clip use RethinkDB to power cloud infrastructure for con-
nected devices
RethinkDB has a vibrant community of over 100,000 developers, and hundreds of con-
tributors from around the world
7.5 Features
1. NoSQL -
schema-less approach: Rethink DB is a JSON document database. A JSON document
represents a structured object consisting of key/value pairs. The value can be either a
primitive data type (integer, string, floating point number) or a nested JSON object (rep-
resented in document form). This means, of course, that JSON can describe arbitrarily
complex objects. Rethink DB stores documents in tables. While this might lead one to
think that Rethink DB has relational database ingredients, the fact is a table is simply
a logical container, the Rethink DB engineers chose to call that container table so that
developers comingfrom a relational background would feel comfortable. A table in Re-
think DB places no real restrictions on the structure of its contained documents. In the
relational world, all rows within a table necessarily have the same structure. But Re-
think DB is schema-less: No two documents, not even documents within the same table,
need to have the same structure. Of course, it is generally beneficial for all documents
in a table to have the same structure, as it simplifies organization and management. But
the flexibility is there, if needed.
4. JOINs and GMR: In Rethink DB, the equivalent of a relational JOIN operation can
actually be performed.
MongoDB
26
REAL TIME DATABASE
A graphical user interface (GUI) called MongoDB Compass gives users a way to work
with document structure, conduct queries, index data and more. The MongoDB Con-
nector for BI allows users to connect the NoSQL database to their business intelligence
tools to visualize data and create reports using SQL queries. Following in the foot-
steps of other NoSQL database providers, MongoDB Inc. launched a cloud database
as a service called MongoDB Atlas in 2016. Atlas runs on AWS, Microsoft Azure and
Google Cloud Platform. More recently, MongoDB released a platform called Stitch
for application development on MongoDB Atlas, with plans to extend it to on-premises
databases.
The company also added support for multi-document ACID transactions as part of Mon-
goDB 4.0 in 2018. Complying with the ACID properties – atomicity, consistency, iso-
lation and durability – across multiple documents expands the types of transactional
workloads that MongoDB can handle with guaranteed accuracy and reliability.
owned by Google Inc. The name of the database was derived from the word humongous
to represent the idea of supporting large amounts of data.
8.3 FEATURE
1. Mongo DB makes it easy:
Mongo DB can consolidate any sort of information - any structure, any arrangement,
and any source - regardless of how frequently it changes, analytical engines can be real-
time and continuous.
2. Scalability:
MongoDB is built to scale out on commodity hardware, in your data center or in the
cloud. And without complex hardware or extra software
3. Real Time:
It can analyze data of any structure from the database, giving you results in real time,
without any data warehouse burdens.
4. High Performance:
Mongo DB provides high performance data persistence. Indexes support faster queries
so CRUD transaction perform smoothly. In support for embedded data models reduces
I/O action on database system.
Mongo DB supports easy syntax for read and write operations (CRUD) as well as: Data
Aggregation Text Search and Geospatial Queries.
6. High Availability:
Mongo DBs replication facility, called replica set, provides-automatic failover and data
redundancy. It keeps similar informational index, giving excess and expanding infor-
mation accessibility.
7.Pricing:
Depends on which RDBMS of course, but Mongo DB is free and can run on Linux,
ideal for running on cheaper commodity kit.
Any new transaction must go through an Admission Control component, which mon-
itors and manages the aggregate number of simultaneously active transactions within
the system in order to avoid transaction failure.
• Each new or resubmitted transaction is assigned a Priority Level, which arranges its
planning inclination in respect to the next simultaneous transactions inside the system.
• Before a transaction performs an operation on a data object, it must experience the
Concurrency Control part so as to accomplish the required synchronization. On the off
chance that the exchange’s demand for a granule is denied, the transaction will be put
into a Wait Queue.
• The waiting transaction will be reactivated when the requested granule becomes avail-
able, after which the transaction performs its operationSimilarly, if a transaction a thing
that is right now not in fundamental memory, an I/O ask for is started and the transac-
tion will be put into a hold up line.
• The holding up exchange will be reactivated when the requested granule becomes
available in fundamental memory, and there is no dynamic higher-need exchange.
• When a transaction completes all of its operations, it commits its result(s) and releases
all of the data items in its possession.
• A transaction may abort/restart a number of times before it commits. There are vari-
31
REAL TIME DATABASE
-Non-terminating abort: An abort due to a deadlock or a data conflict. In this case, the
transaction maybe restarted if its deadline remains feasible.
Real Time database system provides feature with respect to standard physical resource
is the data objects stored in the database. Transactions accessing this data have to be
scheduled in accordance with real-time performance objectives. The scheduling pro-
cess of transactions in a real time database system consists of: Concurrency Control
Locking, Time-stamping, Multiversion, Validation-all of which have the same goal i.e.,
enforcing serializability. These Protocols need to be modified and their trade-off(s)
must be reevaluated under RTDB systems.
33
REAL TIME DATABASE
2. Conflict Resolution:
DEADLOCK
1. Policy1:
a. Always aborts the transaction invoking deadlock detection.
2. Policy 2:
a. Trace the deadlock cycle
b. Abort the first tardy transaction encountered in a deadlock cycle.
c. If no tardy transaction is found, abort the transaction with the furthest deadline.
3. Policy 3:
a. Trace the deadlock cycle.
b. Abort the first tardy transaction encountered in a deadlock cycle.
c. If no tardy transaction is found, abort the transaction with the earliest deadline.
4. Policy 4:
a. Trace the deadlock cycle, and abort the first tardy transaction encountered in a dead-
35
REAL TIME DATABASE
lock cycle.
b. If no tardy transaction is found, abort the transaction with the least criticalness.
5. Policy 5:
a. Abort the infeasible transaction with the least criticalness.
b. If all transactions are feasible, then abort a feasible transaction with the least critical-
ness.
c. This policy is sensitive to the accuracy of the computation time because it requires
information about remaining execution time
d. So, Total execution time requirements at the start of each transaction must be known
CONCLUSION
37
REAL TIME DATABASE
3 InternationalJournalOf InnovativeResearchInComputerAndCommunicationEngineering(
2007Certif iedOrganization), September 2016