Upload
woerrong
View
4
Download
0
Embed Size (px)
DESCRIPTION
the project description for Architectural Analysis
Citation preview
5/28/2018 AA Project Docs v2.2
1/16
IS303 Architectural Analysis Project
Re-architecting an Exchanges Web
Application version ! beta " #anuary 0$%&
$! 'bjectiveStudents are required to demonstrate their understanding of concepts related to performance,
availability, scalability, system architecture design, and exhibit practical skills in dealing with these
issues on a Web application. For this project, a prototype Web application is provided, and students
are required to modify its original design and demonstrate the rearchitected solution during the final
presentation to meet certain nonfunctional requirements. !ou will also get an opportunity to revisit
concepts that you have learnt in several "S courses in this project such as ##$%, S&, &", %' and
(omputational )hinking *if you have done that+.
! Project (i)eline
Week $ctivities
-elease of project requirements *this document+.
o -elease of Scoring -ubric
"n class project briefing.
%eploy prototype on individual laptops
(ollection of switches / 0$1 cables from )$.
2 0ab 3 *Setting up a network+
-un prototype in private network
4 0ab *)omcat clustering+.
Set up project with tomcat cluster
$llocation of interim demonstration tasks to teams by )$
5 0ab 2 *0oad testing+.
Start working on your project6interim demo.
-elease of sample test scripts
7 -un project with concurrent users
(ontinue work on interim task and project
8 (ontinue work on interim task and project
-un some load tests, collect some data
9 "n class "nterim demonstration each team is to give a 37 minute demonstration
of its assigned task. *)his demonstration is worth 7: of your final marks.+
;*recess+
"nstructor may meet up with selected teams to check on progress. !ou will benotified if your team gets selected.
"nstructors will let teams select slots for week 2 presentation.
5/28/2018 AA Project Docs v2.2
2/16
IS303 AA Project v2.2 (Term 2, 2013/14)
3! (he Story so *ar!our client is a small brickandmortar stock exchange intending to *finally+ extend its trading
operations to the Web. )he &xchange?s inhouse ") department has developed a simple Web
application prototype to demonstrate functionality to management. )he prototype was developed
using @S
5/28/2018 AA Project Docs v2.2
3/16
IS303 AA Project v2.2 (Term 2, 2013/14)
*igure $6 7se 8ase 2iagra)
%!$ ,ie static Web pages
0ike most Web sites, the &xchange provides several informational C)'0 pages to all visitors.
(heck out the C)'0 pages in the staticpagesfolder of the prototype Web application. )here are
a variety of C)'0 pages available of different siDes. Some of these pages are huge that may take
a long time to appear in the client?s browser. !ou should preserve how these static pages look
like since they have already been approved by the &xchange?s management. $nyone can view
static pagesE there is no need for authentication. *)hese static pages can be viewed using
http6//9hostIP6port:/Prototype/staticpages/9page;na)e:!ht)l after you have successfully
hosted the prototype.+
%! ,ie current prices
0ike static pages, anyone can view this page without logging in. Aut unlike static pages, this page
shows, for each stock, the last price, the current *highest+ bid price and the current *lowest+ ask
price. )his means that every time this page is refreshed in the browser, it may show different
figures as new buy6sell orders come in. *)his current prices page can be viewed using
http6//9hostIP6port:/Prototype/current!jsp after you have successfully hosted the prototype.+
%!3 .og in/out
Bsers with accounts with the &xchange are able to log into the Web site and log off. When clients
log in to perform a buy or sell operation, they provide a user "% and a password. )o keep things
simple, for this project, there is no need to check if the user "%s and passwords are correctE you
can simply assume that the user "%s and passwords provided are always correct. *)he login
page can be viewed using http6//9hostIP6port:/Prototype/login!jsp after you have successfully
hosted the prototype.+ "f a user attempts to view a protectedG page such as buy!jspor sell!jsp
directly by keying in the full B-0 to these pages, he may be redirected to login!jspif he hasn?t
been authenticated yet.
3
5/28/2018 AA Project Docs v2.2
4/16
IS303 AA Project v2.2 (Term 2, 2013/14)
%!% uy shares
#nly users who have logged in *i.e. authenticated users+ are able to buy shares. Shares are
always transacted in lots of 333 shares at this &xchange, and you can assume that the unit
share price ranges only between H and H33 *including H and H33, with no cents+. When a
user buys shares, the following information is important and needs to be sent to your Web
application the buyer?s user "%, the stock "%, the bid price for each share, and the date6time
stamp of this request. Auyers cannot retract their buy orders once they have sent one in, and all
buy orders will always be for 333 shares *rather than a multiple of 333+. &ach buy order will be
queued in the Web application until it matches a sell order. $t the end of the trading day, all
unmatched buy orders will be discarded. Since this is a small &xchange, there are only 4 types of
shares to buy S'B, 1BS and 1)B.
*)he buy shares page can be viewed using http6//9hostIP6port:/Prototype/buy!jsp after you
have successfully hosted the prototype.+
Aecause settlement of trades *i.e. payment for purchase+ is only done the following day, all
purchasesG are made on credit. )he exchange imposes a credit limit of H,333,333 per user
which is reset at the beginning of each trading day. When a user enters a buy order, your system
must ensure that the buyer?s daily credit limit is not breached. "f so, the buyer?s buy order is
ignored and is not even placed into the queue. For example, a particular buyer has submitted 25
buy orders of 333 S'B shares each at H53 per share. Ce has hence used upG H=83,333 of his
credit, and is left with only H53,333 of credit for buy orders for the day. Ce then submits another
buy order for another lot of S'B shares at a bid price of H73 per share *or H73,333 for 333
shares+. Bnfortunately in this scenario, the system should not allow this new buy order to be
submitted regardless of whether the previous 25 buy orders have been fulfilled, because thebuyer?s credit limit of H,333,333 will be breached if the last buy order goes through. Aesides
showing the user an error message to notify him that his buy order cannot be processed, such
buy orders need to be logged in a log file *rejecte2!log+.
%!< Sell shares
#nly users who have logged in successfully *i.e. authenticated users+ are able to sell shares.
Shares are always transacted lots of 333 shares at this &xchange, and the unit share priceranges between H and H33 *including H and H33+. When a user enters a sell order, the
following information is important and needs to be sent to your Web application the seller?s user
"%, the stock "%, the ask price for each share, and the date6time stamp of this request. Sellers
cannot retract their sell orders once they have made a sell order. &ach sell order will be queued in
the Web application until it matches a buy order. $t the end of the trading day, all unmatched sell
orders will be discarded.
*)he sell shares page can be viewed using http6//9hostIP6port:/Prototype/sell!jsp after you
have successfully hosted the prototype.+
4
5/28/2018 AA Project Docs v2.2
5/16
IS303 AA Project v2.2 (Term 2, 2013/14)
)he ask price is the lowest price a seller of a stock is willing to accept for a share of that given
stock. #n the other hand, the bid price is the highest price a buyer of a stock is willing to pay for a
share of that given stock. )he currentG bid price is the highest bid price in the queue so far, and
the currentG ask price is the lowest ask price in the queue. "n order to match the hordes of buy
and sell orders, the exchange starts with the highest bid and try to match it up with the lowest ask.
"f there is a match, the transaction occurs at either the current ask or current bid price dependingon whether it is a selling trade or a buying trade. $ buying tradeG occurs when a match happens
because of a new buying order. "n a buying tradeG, the transaction price is the current ask price.
$ selling tradeG occurs when a match happens because of a new selling order. "n a selling
tradeG, the transaction price is the current bid price.
Cere is an example to illustrate these rules for a particular stock
)ime
$ction "n the buy queue "n the sell queue (urrent*highest+bid
(urrent*lowest+ask
0ast price
3 $ makes a buy order for 333 shares of
S'B at bid price of H36share
$ *H36share, tI3+ H3 16$ 16$
A makes a buy order for 333 shares ofS'B at bid price of H6share
$ *H36share, tI3+A *H6share, tI+
H 16$ 16$
2 ( makes a sel l order for 333 shares ofS'B at ask price of H26share.*no match+
$ *H36share, tI3+A *H6share, tI+
(*H26share, tI2+ H H2 16$
4 % makes a sel l order for 333 shares ofS'B at ask price of H;6share.*match between % and A. )his is a sellingtrade, and the transaction happens at thecurrent bid price+
$ *H36share, tI3+A *H6share, tI+
(*H26share, tI2+%*H;6share, tI4+
H3 H2 H
5 & makes a sel l order for 333 shares ofS'B at ask price of H26share.*no match+
$ *H36share, tI3+ (*H26share, tI2+&*H26share, tI5+
H3 H2 H
7 F makes a buy order for 333 shares ofS'B at bid price of H26share.*match between F and (. )his is a buyingtrade, and the transaction happens at the
current ask price. 1ote that even though (and & are both asking for H26share, (gets matched first because of its earliertime stamp.+
$ *H36share, tI3+F *H26share, tI7+
(*H26share, tI2+&*H26share, tI5+
H3 H2 H2
)he current prices page should always reflect the correct last, current bid and current ask prices
for each stock. !ou can refer to the following Web pages for a description of the technical termsG
for trading
http66daytrading.about.com6od6daytradingbasics6a6'arket
5/28/2018 AA Project Docs v2.2
6/16
IS303 AA Project v2.2 (Term 2, 2013/14)
*iii+ !our application sends information about the transaction *as in your log file+ to a
remote Aack #ffice Server. !our application communicates with the Aack #ffice
Server using J'0 Web services. Study the prototype to determine how this is done.
)he Aack #ffice Server will then contact the seller and buyer via email and snail mail about their
successful transaction, and perform the necessary followup activities *such as collecting payment
from the buyer and paying the seller, adjusting their balances with the (entral %epository etc+.
)his Aack #ffice Server is 1#) part of your system, but provided as a service by another vendor,
so you do not need to know how it does its job. "t is of course important that the transaction
information received by the Aack #ffice Server tallies with the information in your log file.
%!4 ,ie 7n+ul+ille2 'r2ers
)his page is used primarily for debugging and troubleshooting. "t shows the list of queued *i.e.
unfulfilled buy and sell orders for each of the 4 stocks+, as well as the credit limit of each user "%.
%o ensure that this Web page works and reflects correctly the current stateG of your system. *)he
view unfulfilled orders page can be viewed using
http6//9hostIP6port:/Prototype/vie'r2ers!jsp after you have successfully hosted the
prototype.+
%!5 En2 (ra2ing =ay
)his page is used to simulate the end of a trading day. Aasically when this page is accessed, the
system cleans upG and prepares for the next trading day. For example, unfulfilled buy and sell
requests are discarded as part of the cleaning upG process, and the last pricesG of each stock is
reinitialiDed. *)he &nd )rading %ay page can be viewed using
http6//9hostIP6port:/Prototype/en2(ra2ing=ay!jsp after you have successfully hosted the
prototype.+
.
5/28/2018 AA Project Docs v2.2
7/16
IS303 AA Project v2.2 (Term 2, 2013/14)
1etAeanshttp66netbeans.org6downloadsor any other @ava "%& *)he prototype application
has been tested with 1etAeans 9.2 and )omcat 9.3.28 that comes with 1etAeans.+ K %o not
run your experiments6demo using 1etAeansL
)omcat Web Server *"mportant note during your demonstration, you should 1#) be hosting
your application on )omcat that comes with 1etbeans, but on an independent )omcat server."n other words, your Web application should be running without your "%& open during your
demonstration.+
Misual Studio.1&) 232 Bltimate edition *from %reamSpark+ to perform simulated client tests
*For teams preferring to use @'eter to perform load testing+ @'eter
http66jmeter.apache.org6downloadNjmeter.cgi . )here are a few useful tutorial videos on
!ou)ube about @'eter as well.
1! >our (as!our team?s task is to study the prototype provided and to either modify it or build from scratch a new
Web application to meet the nonfunctional requirements described below. %o not modify the
functionalities and lookandfeel of the Web pages in the prototype as they have already been
approved by the &xchange?s management.
!our final liveG implementation will need to cater for
. *ault tolerance. )he prototype runs on a single physical server, which means that if that
server goes down, your whole application goes down. !ou need to design your system so
that your entire Web site does not depend on the availability of a single server only. "f you
want to set up a cluster for your servers, any client should not be awareG of any failure in yourcluster *except for perhaps, a longer response time+.
*i+ )hink about the various situations in which one of the servers fail *sudden loss of power,
disconnected from the network etc.+ and how your system will react to each of these
scenarios. !ou can simulate some of these failures during your demonstration.
*ii+ "s it possible to automate a server restart in each case of failureO "t will be great if you can
demonstrate a system with automated and seamless failover *the client will not be aware
of any failures, and the system administrator will not need to intervene manually, and
there should be a log file showing erroneous conditions that can be analyDed
subsequently+.
*iii+ "s there any single point of failure *S
5/28/2018 AA Project Docs v2.2
8/16
IS303 AA Project v2.2 (Term 2, 2013/14)
*remember to preserve the functionality and lookandfeel+. )here are three categories of
pages that should run faster
*i+ -esponse time of the various static pages*ii+ -esponse time of the current priceG page*iii+ -esponse time for the buy share and sell share pages
4. ?igh (hroughput. $s a market exchange, volume is as important as response time. !our
application should be able to handle a significant number of concurrent requests. Bse your
load tester to measure the rate at which your application accepts and processes incoming
buy6sell orders. 1ote that response times *discussed above+ and throughput may be inter
dependent K be aware of and discuss any tradeoffs involved.
5. ?ori@ontal scalability. !our Web application is expected to be easily scalable as the number
of online users increase over time. !our team is expected only to focus on horiDontal
scalability *scaling by adding more servers+, and not on vertical scalability *scaling by adding
more physical resources to each machine such as -$'+.
7. Reliance on an external syste). !our Web application communicates with an external Web
service provided by your Aack #ffice Server partner. )here is no guarantee that this Web
service will be always upE in fact, your team has been warned that this communications
gateway does suffer from periodic unscheduled downtime as your partner struggles with
capacity issues. !our team has to make a decision as to what should be done in the event
that your application is unable to communicate with the Aack #ffice Server during a send to
back officeG operation.
Whatever the case, it is very important that the figuresG balance in the sense that all the
transaction information is correctly sent over. )hat is, you need to ensure that by the end of
each trading day, all the transactions in your log file match the information sent over to the
Aack #ffice Server. $fter all, clients will be very unhappy if they are not informed if theirbuy6sell bid went through *-ecall that there were some system hiccups during Facebook?s
"
5/28/2018 AA Project Docs v2.2
9/16
IS303 AA Project v2.2 (Term 2, 2013/14)
*i+ $ll buying orders and selling orders that have been successfully sent to the server are
taken into consideration. 1o orders should be lostG. For example
total number of buying orders successfully sent to the server Itotal number of buying orders in your unfulfilled buying order list Pnumber of matched transactions *as recorded in your )atche2!logfile+ P
number of rejected buy orders *recorded in your rejecte2!logfile+.
*ii+ )he credit limit of each user should never be breached at any time during a buyG.
*iii+ When a series of buy and sell orders are placed in slow sequence, they should result
in a fixed stable state *for example, if the series of requests in the table in section 5.7
are played out in a simulation using a load tester, the outcome of current!jsp,
)atche2!logand rejecte2!logshould be predictable and consistent.
*iv+ $t the end of the trading day, the contents of )atche2!logand the information sent
to the Aack #ffice system are consistent.
"t is very important to think about how each of these goals can be achieved if you have aclustered environment. Malidate empirically *using load tests+ that your system produces the
same results when clustered and when running singly.
9. 'thers! "t is very important that you are able to demonstrate that you have achieved
improvement in the abovementioned nonfunctional attributes in a scientific and rigorous
manner. For example, you need to show C#W you detected that the average response time
to a particular static page has decreased for the same client load, with figures to support your
claim. (redit will also be given to teams which can improve the other aspects of *i+
maintainability, *ii+ manageability and *iii+ extensibility of your Web application.
!ou should apply the theoretical concepts taught in the course, and find out how scalability,
availability and performance can be improved in a real enterprise system *these may not be covered
in the course+. Sometimes decisions about tradeoffs will need to be made for example, between
performance and availability. 1o marks will be awarded for effort spent on beautifying the user
interface *i.e. Web pages+. !ou should focus on the nonfunctional aspects instead.
1ote we have decided to exclude the *very important+ nonfunctional attribute of securityfrom your
scope. For example, there is also no need to encrypt communications between clients and the
exchange server using SS0 *this is also always done for such Web applications involving financial
liability+. Security is often antagonistic to other nonfunctional attributes *for example, running the Web
application over SS0 improves security by encrypting all the data transmitted over the network, but
inevitably decreases performance+. For this project, you can ignore the security aspect of your Web
application and focus on the other quality attributes. Aut do be aware that in real enterprise
applications, security is often one of the most important quality attributes and often takes precedence
over performance, availability and scalability.
4! Rules
. !our final Web application implementation should be based on @S
5/28/2018 AA Project Docs v2.2
10/16
IS303 AA Project v2.2 (Term 2, 2013/14)
technologies. So if your team wishes to select a different platform *e.g. $S< instead of @S
5/28/2018 AA Project Docs v2.2
11/16
IS303 AA Project v2.2 (Term 2, 2013/14)
&ach team will be given 4< )inutesfor your final presentation, questions and demonstration.
!ou !ll "!#$ t%!& t!'%t. Ae sure to arrive early to setup and be ready.
1ote that no servers will be provided for your demonstrations which means that you will need to host
your solution on your own laptops. $s previously noted, you do not gain additional points for
demonstrating a short response time, but you need to demonstrate a SC#-)&- response time
compared to the original prototype under same network conditions. !ou do 1#) get points for
improving response time by decreasing network latency *for example, using a private wired 0$1 over
wireless 0$1+, but you do gain points by showing that certain code or architectural changes have
decreased response time of clients viewing your Web pages.
! =eliverables)he following are to be submitted in a BSA portable drive $) )C& S)$-) of your final presentation
*we will return your drive after copying the contents+
. $ 2eploy)ent 2iagra)showing how your solution is hosted, with short notes justifying your
deployment decisions, if necessary.
2. Full source co2eof your working system.
5/28/2018 AA Project Docs v2.2
12/16
IS303 AA Project v2.2 (Term 2, 2013/14)
*igure 6 Sub)ission +or)at
)eams will be penaliDed for missing deliverables or failure to prepare the deliverables as required
*e.g. wrong folder names+.
$0! Bra2ing)his project comprises 30Cof your final score for this course *7: for interim demonstration, 27: for
final presentation6demonstration6submission+. "t is important that all team members contribute fairly to
the project. $ll team members should expect to be asked questions about the experiments and
system.
)he peer review form allows students to grade fellow team members on quality of work contributed,
quantity of work contributed, technical expertise and general contribution. )he peer review results will
be used to identify outstanding and undercontributing team members within the team, and can be
used to vary individual scores for the project. 1evertheless, teams are encouraged to surface teaming
issues earlier on in the semester to instructors so that they can be monitored early and resolved.
10.1 Interim demonstration:
!ou will receive a score between 3 and 7 based on your demonstration. Rrading rubric
Score
%escription
3 )eam is still in lalaland.
0ittle work has been done, but we pity you enough not to award a Dero.
2 Some work has been done, but team has difficulties getting the basic setup right.
4 )eam has completed a major part of the assigned task, and answered some of thequestions in their task description with empirical evidence.
5 -esults are presented in a clear and systematic manner. )eam has completed theassigned task, and has answered most of the questions with empirical evidence.
7 )eam has demonstrated good overall investigative skills and done a significantamount of experimental work to answer the questions in the task description.
10.2 Final Presentation:
)he following list is detailed in the grading sheet, posted separately. $ filled outgrading
sheet must be brought to the final presentation.
%eliverables 7: quality of code, material, all required files and documents included
12
5/28/2018 AA Project Docs v2.2
13/16
IS303 AA Project v2.2 (Term 2, 2013/14)
Fault )olerance 43: any single points of failureO Cow fast is failoverO "s restart
simple and easyO
Cigh
5/28/2018 AA Project Docs v2.2
14/16
IS303 AA Project v2.2 (Term 2, 2013/14)
Appen2ix A6 Running the Prototype)he prototype can be easily executed and edited using 1etbeans 9.2 *with $pache )omcat 9.2.29+,
although you are free to use any other @ava "%& you prefer.
#btain the prototype.Dip file from e0earn, and unDip it to your hard disk
"f you have 1etbeans 9.2, select, File#pen
5/28/2018 AA Project Docs v2.2
15/16
IS303 AA Project v2.2 (Term 2, 2013/14)
Appen2ix 6 So)e 7se+ul Re+erences
"S434 0ab (overs clustering of 2 )omcat servers using modNjk
"S434 0ab 2 (overs load testing of a Web application using Misual Studio )eam System
'y ST0 (luster http66dev.mysql.com6downloads6cluster69.3.html*"f you intend to perform
database server clustering using 'yST0, you will need to get the 'yST0 (luster editionE the
(ommunity Server edition does not support clustering.+
Bseful book on 'yST0 (lustering ?igh Per+or)ance DyS.G *2ndedition+ by SchwartD,
Uaitsev, )kachenko, Uawodny, 0entD and Aalling. S'B students have access to the online
version of this book via the S'B library Website.
$ brief overview of )omcat clustering *what are sticky sessionsO What is session replicationO+
http66www.easywayserver.com6tomcatclustering.htm
)wo quick writeups about general conceptshttp66www.datadisk.co.uk6htmlNdocs6javaNapp6tomcat86tomcat8Nclustering.htmandhttp66www.vicconsult.com6tips6apachetomcatloadbalancesessionreplication.html
15
http://dev.mysql.com/downloads/cluster/7.0.htmlhttp://library.smu.edu.sg/http://library.smu.edu.sg/http://www.easywayserver.com/tomcat-clustering.htmhttp://www.datadisk.co.uk/html_docs/java_app/tomcat6/tomcat6_clustering.htmhttp://www.datadisk.co.uk/html_docs/java_app/tomcat6/tomcat6_clustering.htmhttp://www.vicconsult.com/tips/apache-tomcat-load-balance-session-replication.htmlhttp://dev.mysql.com/downloads/cluster/7.0.htmlhttp://library.smu.edu.sg/http://www.easywayserver.com/tomcat-clustering.htmhttp://www.datadisk.co.uk/html_docs/java_app/tomcat6/tomcat6_clustering.htmhttp://www.vicconsult.com/tips/apache-tomcat-load-balance-session-replication.html5/28/2018 AA Project Docs v2.2
16/16
IS303 AA Project v2.2 (Term 2, 2013/14)
Appen2ix 86 Presentation 8heclist
o $ll deliverables in section = placed on thumb drive before presentation
o Slides showing response time include variance *points awarded for including, and deducted if
missing+
o (ode for transaction matching and for back office opened in development environment for
instructors to view it.
o 0oad test, including buys6sells, ready to run *Vusers K should not create errorsE time 43 minE
bids6asks should be random+
o %atabase set and ready to go
o