The document describes a Twitter application project that includes implementing basic user functionality like sign up, sign in, profile, tweets, re-tweets, hashtags, and connection pooling. The system design uses AngularJS for the front end, Node.js as the middleware, and MySQL for the backend database. Node.js connects the client and server. Details of implementing specific features like sign up, profile, tweets, hashtags, and connection pooling testing are provided.
1. Dhiraj Gurnani
Twitter
Goals:
We have to implement a twitter application and we have to implement the below features
1. Basic User functionalities:
a. Sign up the new users (First name, Last name, Email, Password). Passwords
have to be encrypted
b. Sign in with existing users
c. Sign out
2. Profile:
a. About: Birthday, Twitter handle, contact information and location
b. Followers and Following list. You should be able to follow people.
c. Show your tweets and re-tweets
3. Twitter feed functionality showing tweets of people you are following and option
to re-tweet.
4. Implementing Hashtag (#) functionality (in Search and Tweets).
5. Implement Connection pooling for database access
System Design:
We have implemented angular js in the front end and bootstrap as well which will help us
in the client side and we will be able to get attractive ui.
Node js in the middleware where we can call different type of queries and we are able to
perform functions which will help us to basic programing in the middle
The backend is mysql which is connected with the middleware throw server.
This is how the client and the server is connected.
1 Basic User functionalities
Signup
23. Dhiraj Gurnani
Explaination of the graph.
As we can see the graph plottedforthe Usercallsusingthe connectionpoolingandwithoutconnection
pooling,there ischange inthe behaviour.
Withconnectionpooling Withoutconnectionpooling
100 users 10 12
200 users 8 9
300 users 11 12
400 users 10 11
500 users 8 10
There is approximately 13% difference in the between both the connection pooling and without
connection pooling.
This difference is because of pools which are present which will save time for connection toget
established and get destroyed. These are not present without connection pooling so it takes more time.
Mocha
Mocha is not running in my system I tried the whole I hope you understand it I Emailed you too.
0
2
4
6
8
10
12
14
100 user 200 users 300 users 400 users 500 users
Chart Title
with pooling without pooling
24. Dhiraj Gurnani
3.Questions.
A1
UsingBcrypt module forencryptioninthe twitterproject.
It workson Blowfishcipher,whichcomesupwithdifferentpasswords.
Bcrypt givesportability andcrossplatformsupport.
Bcrypt ingetsthe programgets the passwordandgeneratesanotherpasswordwithitsuse afterthat
bcrypt storesthe passwordinthe database andin the signin functionbcryptgetsthe passwordfrom
the userinputand will compare the passwordwithitsowncompare functionandthiswill give the
resultandwe will be able tosignin.Itoperateson64-bitof data,usinga56-bit. It isa ‘private key’
system.
HASH
It isused of a fixedlength input.Itisalso knownas a 'message digest',ora 'fingerprint'..
MD5
It isa 128 bit message digestfunctionwhichisnotuseful for informationmore thanit.
HMAC
HMAC is a hashingmethodthatsuch as MD5 or SHA-1.
A2.
25. Dhiraj Gurnani
Here above isthe chart of the data got byjmetertestwithusingconnectionpoolingandwithoutusing
connectionpooling
Withoutconnectionpoolingwe have tocreate a connectioneverytime andwe have toremove itevery
time thistakesa lotof time toestablishaconnectioneverytime anddelete iteverytime.
In connectionpoolingwe have apool establishedsowe justhave touse a connectionfromthe pool so
thiswill helpustosave some time andour code will be implementedfaster
Algorithm
1 We have firstinitializedapool of array
2 There are 100 connectionsinthe pool.
3 Noweverytime we needtoconnecttothe database we just have toget the connection fromthe pool
whichisreadyto use
4 afterwe are done withthe usage we give the connectionbacktothe pool.
A3.
LeastRecentlyUsedalogorithmhasbeenusedall the placesrecentlyusedfieldsthat are full while the
time of search.All the frequentlyuseddatahasbeensavedinthe memory.Datais used,how much
more data usedand at whattime.If the data iscostlyand whichconformswhenthe usage iscompleted
the cached isempitied of the expensivedata.So,basicallyrecentlyuseddatawill be savedandone can
getthe oftenuseddata.
0
2
4
6
8
10
12
14
100 user 200 users 300 users 400 users 500 users
Chart Title
with pooling without pooling
26. Dhiraj Gurnani
In requestcachingdatais savedinthe serverwiththe helpof key-value pair.Everytime arequestis
made the data is got fromthe server.Of all the caches available thisismostlyusedbecause cache is
managedbeyondthe applicationbythe browser.Thismakesthe applicationtofetchdatafaster.
Whenwe opena page andsenda requestthe cookieswouldbe checkandif the last checkwasthe
same as thisit will notsendthe whole fileorelse itwill sendsothiswillsave the time andmake the
applicationrunfaster.
Calculator:
DESCRIPTION:
The goal is designingabasic calculator to demonstrate statelessweb service and givingit the basic
functionalityalso taking care of the errors
SystemDesign:
I have choosennode jsand HTML5 for this application.
HTML5 is implementedinthe frontendof the application from we get the input and dependingonthe
operationselectedwe give them the output indifferentpage and after it we bring themin the same
page to perform anothercalculation
Calculator
Application Home screen
Addition
34. Dhiraj Gurnani
Jmeter
Graph Discription:
the architecture of Node.JswhichsupportsNonBLocking,Asynchronous andSingleEventLoop
frameworkanditalso cachesthe requestsfromthe same user. The above resulthasbeen
Calculate
1 user 1000 calls 5
1 user 5000 calls 4
100 user 1000 calls 20
0
5
10
15
20
25
1 user 1000 call I user 5000 calls 100 users 1000 calls
Series 1
Series 1