SlideShare a Scribd company logo
APPLICATION
ARCHITECTURE FOR
THE REST OF US
Presented by
M N Islam Shihan
Introduction
   Target Audience
   What is Architecture?
     Architecture is the foundation of your application
     Applications are not like Sky Scrappers

     Enterprise Vs Personal Architecture

   Why look ahead in Architecture?
     Adaptabilitywith Growth
     Maintainability

     Requirements never ends
Enterprise Architecture (cont…)
   Security
   Responsiveness
   Extendibility
   Availability
   Load Management
   Distributed Computation
   Caching
   Scalability
Security
Security (cont…)
Think about Security first of all
 Network Security: Implement Firewall &

Reverse Proxy for your network
 SQL Injection: Never forget to escape

field values in your queries
 XSS (Cross Site Scripting): Never trust user provided
   (or grabbed from third party data sources) data and
   display without sanitizing/escaping
 CSRF (Cross Site Request Forgery): Never let your

   forms to be submitted from third party sites
Security (cont…)
   DDOS (Distributed Daniel of Services): Enable real
    time monitoring of access to detect and prevent DDOS
    attacks
   Session fixation: Implement session key
    regeneration for every request
   Always hash your security tokens/cookies with new
    random salts per request/session basis (or in an
    interval)
   Stay tuned and up-to-date with security news and
    releases of all of your used tools and technologies
Responsiveness
Responsiveness (cont…)
   Web applications should be as responsive as Desktop
    Applications
   Plan well and apply good use of JavaScript to achieve
    Responsiveness
   Detect browsers and provide separate
    response/interface depending on detected browser
    type
   Implement unobtrusive use of JavaScript
   Implement optimal use of Ajax
   Use Comet Programming instead of Polling
   Implement deferred/asynchronous processing of
    large computations using Job Queue
Extendibility
   Implement and use robust data access
    interface, so that they can be exposed easily
    via web services (like REST, SOAP, JSONP)
   Use architectural patterns & best practices
     SOA(Service Oriented Architecture)
     MVC (Model View Controller)

   Modular architecture with plug-ability
   Allow hooks and overrides through Events
Availability
Availability (cont…)
   Implement well planned Disaster Recovery policy
   Use version control for your sources
   Use RAID for your storage devices
   Keep hot standby fallback for each of your primary
    data/content servers
   Perform periodical backup of your source repository,
    files & data
   Implement periodical archiving of your old data
   Provide mechanism to the users to switch between
    current and archived data when possible
Load Management
Load Management (cont…)
   Monitor and Benchmark your servers periodically and
    find pick usage time
   Optimize to support at least 150% of pick time load
   Use web servers with high I/O performance
   Introduce load balancer to distribute loads among
    multiple application Servers
   Start with software (aka. reverse proxy) then grow to
    use hardware load balancer only if necessary
   Use CDNs to serve your static contents
   Use public CDNs to serve the open source JavaScript
    or CSS files when possible
Caching
   To Cache Or Not to Cache?
       Analyze the nature of content and response generated by your
        application very well
       What to cache?
       Analyze and set proper expiry time
       Invalidate cache whenever content changes
       Partial caching will also bring you speed
       When caching is bad?
   Understand various types of web caches
       Browser cache
       Proxy cache
       Gateway cache
Caching (cont…)
   Implement server side caching
       Runtime in-memory cache
         Per request: Global variables
         Shared: Memcached

       Persistent Cache
         Per Server: File based, APC
         Shared: Db based, Redis

       Optimizers and accelerators: eAccelerator, XCache
   Reverse proxy/gateway cache
       Varnish cache
Distributed Computing
Scalability
   What the heck is this?
   Scalability is the soul of enterprise
    architecture
   Scalability pyramid
Scalability (cont…)
Vertical Scalability (scaling up)
Scalability (cont…)
Horizontal Scalability (scaling out)
Scalability (cont…)
Scalability
   Scaling up (vertical) vs. Scaling out
    (horizontal)
Scalability
   Database Scalability
     Vertical:   Add resource to server as needed
       In   most cases produce single point of failure
     Horizontal: Distribute/replicate data among
      multiple servers
     Cloud Services: Store your data to third party
      data centers and pay with respect to your usage
Scalability (cont…)
Scaling Database
Scaling options
 Master/Slave
       Master for Write, Slaves for Read
   Cluster Computing
       Single storage with multiple server node
   Table Partitioning
       Large tables are split among partitions
   Federated Tables
       Tables are shared among multiple servers
   Distributed Key Value Stores
   Distributed Object DB
   Database Sharding
Scalability (cont…)
Database Sharding
                     Smaller databases are
                      easier to manage
                     Smaller databases are
                      faster
                     Database sharding can
                      reduce costs
                     Need one or multiple
                      well define shard
                      functions
                     "Don't do it, if you don't
                      need to!"
                      (37signals.com)
                     "Shard early and often!"
                      (startuplessonslearned.
                      blogspot.com)
Scalability (cont…)
Database Sharding
When appropriate?                              What to analyze?
   High-transaction database                     Identify all transaction-intensive
    applications                                   tables in your schema.
   Mixed workload database usage                 Determine the transaction volume
       Frequent reads, including complex          your database is currently handling
        queries and joins                          (or is expected to handle).
       Write-intensive transactions (CRUD        Identify all common SQL statements
        statements, including INSERT,              (SELECT, INSERT, UPDATE,
        UPDATE, DELETE)                            DELETE), and the volumes
       Contention for common tables and/or        associated with each.
        rows
                                                  Develop an understanding of your
   General Business Reporting                     "table hierarchy" contained in your
       Typical "repeating segment" report         schema; in other words the main
        generation                                 parent-child relationships.
       Some data analysis (mixed with other      Determine the "key distribution" for
        workloads)                                 transactions on high-volume tables,
                                                   to determine if they are evenly
                                                   spread or are concentrated in narrow
                                                   ranges.
Scalability (cont…)
Database Sharding
   Challenges
     Reliability
       Automated   backups
       Database Shard redundancy
       Cost-effective hardware redundancy
       Automated failover
       Disaster Recovery

     Distributed   queries
       Aggregation  of statistics
       Queries that support comprehensive reports
Scalability (cont…)
Database Sharding
   Challenges (cont…)
     Avoidance  of cross-shard joins
     Auto-increment key management
     Support for multiple Shard Schemes
       Session-based sharding
       Transaction-based sharding
       Statement-based sharding
     Determine   the optimum method for sharding the
     data
       Shard by a primary key on a table
       Shard by the modulus of a key value
       Maintain a master shard index table
Scalability (cont…)
Database Sharding
Example Bookstore schema showing how data is sharded
Tools
   Application framework
   Load balancer with multiple application servers
   Continuous integration
   Automated Testing
       TDD (Test Driven Development)
       BDD (Behavior Driven Development)
   Monitoring
       Services
       Servers
       Error Logging
       Access Logging
   Content Data Networks (CDN)
   FOSS
Think Ahead
Think Ahead (cont…)
   Understand business model
   Analyze requirement in greatest detail
   Plan for extendibility
   Be agile, do incremental architecture
   Create/use frameworks
   SQL or NoSQL?
   Sharding or clustering or both?
   Cloud services?
Guidelines
   Enrich your knowledge: Read, read & read. Read
    anything available : jokes to religions.
   Follow patterns & best practices
   Mix technologies
     Don’t let your tools/technologies limit your vision
     Invent/customize technology if required

   Use FOSS
     Don’t expect ready solutions
     Find the closest match
     Customize as needed
Guidelines (cont…)
Database Optimization
   Use established & proven solutions
       MySQL
       PostgreSQL
       MongoDB
       Redis
       Memchached
       CouchDB
   Understand and utilize indexing & full-text search
   Use optimized DB structure & algorithms
       Modified Preorder Tree Traversal (MPTT)
       Map Reduce
   ORM or not?
Guidelines (cont…)
Database Optimization
   Optimize your queries
     One  big query is faster than repetitive smaller
      queries
     Never be lazy to write optimized queries
       One   Ring to Rule `em All
     Use  Runtime In Memory Cache
     Filtering in-memory cached dataset is much
      faster than executing a query in DB
Guidelines (cont…)
  One Ring to Rule `em All
  Perform Selection, then Projection, then Join
                          a_i
                           d

         A                              B                             C


1,000 records                   1000,000 records             1000,000,000
                                                             records

   A simple example
   Write a standard SQL query to find all records with fields A.a1, B.b1 and
      C.c1 from tables A (id, a1,a2, a3, …,aP), B (id, a_id, b1, b2, b3, …, bQ),
      and C(id, b_id, c1, c2, c3, …,cR) given that A.aX, B.bY and C.cZ will
      match ‘X’, ‘Y’ and ‘Z’ values respectively.
   Assume all tables A, B, C has primary keys defined by id column and a_id
     and b_id are the foreign keys in B from A and in C from B respectively.
Guidelines
One Ring to Rule `em All (cont…)
Solution 1
SELECT A.a1, B.b1, C.c1
FROM A, B, C
WHERE A.id = B.a_id AND B.id = C.b_id
AND A.aX = ‘X’ AND B.bY = ‘Y’ AND C.cZ = ‘Z’

Why it Sucks?
•Remembered the size of A, B and C tables?
•Cross product of tables are always memory extensive, why?
    •A x B x C will have 1,000 x 1,000,000 x 1,000,000,000 records with (P
    +1) + (Q +2) + (R +2) fields
    •Can you imagine the size of in-memory result set of joined tables?
    •It will be HUGE
Guidelines
One Ring to Rule `em All (cont…)
Solution 2
SELECT A.a1, B.b1, C.c1
FROM A
   INNER JOIN B ON A.id = B.a_id
   INNER JOIN C ON B.id = C.b_id
WHERE A.aX = ‘X’ AND B.bY = ‘Y’ AND C.cZ = ‘Z’

Why it still Sucks?
•A B C will produce (1,000 x 1,000,000) records to perform A B and
then produce another (1,000 x 1,000,000,000) records to compute (A B)       C
and then it will filters the records defined by WHERE clause.
•The number of fields, that is P+1 in A, Q+2 in B and R+2 in C will also
contribute in memory consumption.
•It is optimized but still be HUGE with respect to memory consumption and
computation
Guidelines
One Ring to Rule `em All (cont…)
Optimal Solution
SELECT A.a1, B.b1, C.c1
FROM (SELECT id, a1 FROM A WHERE aX = ‘X’) as A
INNER JOIN ( SELECT id, b1, a_id FROM B WHERE bY = ‘Y’) as B ON A.id =
   B.a_id
INNER JOIN ( SELECT id, c1, b_id FROM C WHERE cZ = ‘Z’) as C ON B.id =
Why this solution out performs?
   C.b_id
•Let’s keep the explanation as an exercise 
Reference : Tools
   Security
       Nmap: http://nmap.org/
       Nikto: http://cirt.net/Nikto2
       List of Tools: http://sectools.org/
   Caching
       APC: http://php.net/manual/en/book.apc.php
       XCache: http://xcache.lighttpd.net/
       eAccelerator: http://sourceforge.net/projects/eaccelerator/
       Varnish Cache: https://www.varnish-cache.org/
       MemCached: http://memcached.org/
       Redis: http://redis.io/
   Load Balancer
       HAProxy: http://haproxy.1wt.eu/
       Pound: http://www.apsis.ch/pound/
Reference : Tools (cont…)
   NoSQL
       MongoDB: http://www.mongodb.org/
       CouchDB: http://couchdb.apache.org/
       A complete list: http://nosql-database.org/
   Distributed Computing
       GearMan: http://gearman.org/
   Message Queue/Job Server
       RabitMQ: http://www.rabbitmq.com/
       ActiveMQ: http://activemq.apache.org/
   Monitoring
       Nagios: http://www.nagios.org/
   Testing
       Selenium: http://seleniumhq.org/
       Cucumber: http://cukes.info/
       Watir: http://watir.com/
       PhpUnit: http://www.phpunit.de/manual/3.7/en/
   MPTT
       Shameless Promotion: https://github.com/mnishihan/phpMptt
Reference : Articles
   Caching
       http://www.mnot.net/cache_docs/
       http://bit.ly/9cTJfA
   Load Balancing
       http://en.wikipedia.org/wiki/Load_balancing_%28computing%29
       http://1wt.eu/articles/2006_lb/index.html
   Scalability & Architecture
       http://www.diranieh.com/DistributedDesign_1/Scalability.htm
       http://www.infoq.com/presentations/Facebook-Software-Stack
       http://99designs.com/tech-blog/blog/2012/01/30/infrastructure-at-99designs/
       http://bit.ly/16cKu
   Database Sharding
       http://www.codefutures.com/database-sharding/
       http://bit.ly/Y3b3J
       http://www.startuplessonslearned.com/2009/01/sharding-for-startups.html
   CDN
       http://bit.ly/sMRyxC
   MPTT
       http://www.sitepoint.com/hierarchical-data-database/
Thank You
Join phpXperts [http://bit.ly/phpxperts]
Follow me on twitter [http://twitter.com/mnishihan]
Subscribe in facebook [http://fb.me/mnishihan]
Questions???
I will be glad to answer 

More Related Content

What's hot

CodeFutures - Scaling Your Database in the Cloud
CodeFutures - Scaling Your Database in the CloudCodeFutures - Scaling Your Database in the Cloud
CodeFutures - Scaling Your Database in the Cloud
RightScale
 
Architectural Anti Patterns - Notes on Data Distribution and Handling Failures
Architectural Anti Patterns - Notes on Data Distribution and Handling FailuresArchitectural Anti Patterns - Notes on Data Distribution and Handling Failures
Architectural Anti Patterns - Notes on Data Distribution and Handling FailuresGleicon Moraes
 
A Seminar on NoSQL Databases.
A Seminar on NoSQL Databases.A Seminar on NoSQL Databases.
A Seminar on NoSQL Databases.
Navdeep Charan
 
Apache Cassandra introduction
Apache Cassandra introductionApache Cassandra introduction
Apache Cassandra introduction
fardinjamshidi
 
A NOVEL APPROACH FOR HOTEL MANAGEMENT SYSTEM USING CASSANDRA
A NOVEL APPROACH FOR HOTEL MANAGEMENT SYSTEM USING CASSANDRAA NOVEL APPROACH FOR HOTEL MANAGEMENT SYSTEM USING CASSANDRA
A NOVEL APPROACH FOR HOTEL MANAGEMENT SYSTEM USING CASSANDRA
ijfcstjournal
 
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEMCASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
IJCI JOURNAL
 
Indic threads pune12-nosql now and path ahead
Indic threads pune12-nosql now and path aheadIndic threads pune12-nosql now and path ahead
Indic threads pune12-nosql now and path ahead
IndicThreads
 
Lecture4 big data technology foundations
Lecture4 big data technology foundationsLecture4 big data technology foundations
Lecture4 big data technology foundations
hktripathy
 
SQL or NoSQL, is this the question? - George Grammatikos
SQL or NoSQL, is this the question? - George GrammatikosSQL or NoSQL, is this the question? - George Grammatikos
SQL or NoSQL, is this the question? - George Grammatikos
George Grammatikos
 
No sql databases explained
No sql databases explainedNo sql databases explained
No sql databases explained
Salil Mehendale
 
Introducing Azure SQL Database
Introducing Azure SQL DatabaseIntroducing Azure SQL Database
Introducing Azure SQL Database
James Serra
 
Data stax no sql use cases
Data stax  no sql use casesData stax  no sql use cases
Databases in the Cloud
Databases in the CloudDatabases in the Cloud
Databases in the Cloud
Amazon Web Services
 
2014.11.14 Data Opportunities with Azure
2014.11.14 Data Opportunities with Azure2014.11.14 Data Opportunities with Azure
2014.11.14 Data Opportunities with Azure
Marco Parenzan
 
DSM - Comparison of Hbase and Cassandra
DSM - Comparison of Hbase and CassandraDSM - Comparison of Hbase and Cassandra
DSM - Comparison of Hbase and Cassandra
Shrikant Samarth
 
SQL/NoSQL How to choose ?
SQL/NoSQL How to choose ?SQL/NoSQL How to choose ?
SQL/NoSQL How to choose ?
Venu Anuganti
 
JATSPack and JATSPAN, a packaging format specification and a web site
JATSPack and JATSPAN, a packaging format specification and a web siteJATSPack and JATSPAN, a packaging format specification and a web site
JATSPack and JATSPAN, a packaging format specification and a web site
Klortho
 
Cassandra - A Distributed Database System
Cassandra - A Distributed Database System Cassandra - A Distributed Database System
Cassandra - A Distributed Database System
Md. Shohel Rana
 

What's hot (20)

CodeFutures - Scaling Your Database in the Cloud
CodeFutures - Scaling Your Database in the CloudCodeFutures - Scaling Your Database in the Cloud
CodeFutures - Scaling Your Database in the Cloud
 
Architectural Anti Patterns - Notes on Data Distribution and Handling Failures
Architectural Anti Patterns - Notes on Data Distribution and Handling FailuresArchitectural Anti Patterns - Notes on Data Distribution and Handling Failures
Architectural Anti Patterns - Notes on Data Distribution and Handling Failures
 
A Seminar on NoSQL Databases.
A Seminar on NoSQL Databases.A Seminar on NoSQL Databases.
A Seminar on NoSQL Databases.
 
Apache Cassandra introduction
Apache Cassandra introductionApache Cassandra introduction
Apache Cassandra introduction
 
No sql
No sqlNo sql
No sql
 
A NOVEL APPROACH FOR HOTEL MANAGEMENT SYSTEM USING CASSANDRA
A NOVEL APPROACH FOR HOTEL MANAGEMENT SYSTEM USING CASSANDRAA NOVEL APPROACH FOR HOTEL MANAGEMENT SYSTEM USING CASSANDRA
A NOVEL APPROACH FOR HOTEL MANAGEMENT SYSTEM USING CASSANDRA
 
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEMCASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
CASSANDRA A DISTRIBUTED NOSQL DATABASE FOR HOTEL MANAGEMENT SYSTEM
 
Indic threads pune12-nosql now and path ahead
Indic threads pune12-nosql now and path aheadIndic threads pune12-nosql now and path ahead
Indic threads pune12-nosql now and path ahead
 
Lecture4 big data technology foundations
Lecture4 big data technology foundationsLecture4 big data technology foundations
Lecture4 big data technology foundations
 
SQL or NoSQL, is this the question? - George Grammatikos
SQL or NoSQL, is this the question? - George GrammatikosSQL or NoSQL, is this the question? - George Grammatikos
SQL or NoSQL, is this the question? - George Grammatikos
 
No sql databases explained
No sql databases explainedNo sql databases explained
No sql databases explained
 
Datastores
DatastoresDatastores
Datastores
 
Introducing Azure SQL Database
Introducing Azure SQL DatabaseIntroducing Azure SQL Database
Introducing Azure SQL Database
 
Data stax no sql use cases
Data stax  no sql use casesData stax  no sql use cases
Data stax no sql use cases
 
Databases in the Cloud
Databases in the CloudDatabases in the Cloud
Databases in the Cloud
 
2014.11.14 Data Opportunities with Azure
2014.11.14 Data Opportunities with Azure2014.11.14 Data Opportunities with Azure
2014.11.14 Data Opportunities with Azure
 
DSM - Comparison of Hbase and Cassandra
DSM - Comparison of Hbase and CassandraDSM - Comparison of Hbase and Cassandra
DSM - Comparison of Hbase and Cassandra
 
SQL/NoSQL How to choose ?
SQL/NoSQL How to choose ?SQL/NoSQL How to choose ?
SQL/NoSQL How to choose ?
 
JATSPack and JATSPAN, a packaging format specification and a web site
JATSPack and JATSPAN, a packaging format specification and a web siteJATSPack and JATSPAN, a packaging format specification and a web site
JATSPack and JATSPAN, a packaging format specification and a web site
 
Cassandra - A Distributed Database System
Cassandra - A Distributed Database System Cassandra - A Distributed Database System
Cassandra - A Distributed Database System
 

Viewers also liked

Server Management
Server ManagementServer Management
Server Management
Dell World
 
Rg0035 A Guideto Service Improvement Nhs Scotland
Rg0035 A Guideto Service Improvement Nhs ScotlandRg0035 A Guideto Service Improvement Nhs Scotland
Rg0035 A Guideto Service Improvement Nhs Scotlandprimary
 
Application Architecture Trends
Application Architecture TrendsApplication Architecture Trends
Application Architecture Trends
Srini Penchikala
 
Developing and implementing asset lifecycle management strategies
Developing and implementing asset lifecycle management strategiesDeveloping and implementing asset lifecycle management strategies
Developing and implementing asset lifecycle management strategies
Benjamin Mqenebe
 
L01 Enterprise Application Architecture
L01 Enterprise Application ArchitectureL01 Enterprise Application Architecture
L01 Enterprise Application Architecture
Ólafur Andri Ragnarsson
 
Server training
Server trainingServer training
Server training
itassistantdahanu
 
Application Architecture
Application ArchitectureApplication Architecture
Application Architecture
Lars-Erik Kindblad
 
Types of server
Types of serverTypes of server
Types of server
IGZ Software house
 
Servers
ServersServers
Web Security
Web SecurityWeb Security
Web Security
ADIEFEH
 
What is a Server
What is a ServerWhat is a Server
What is a Server
Kuwait10
 
Introduction to Enterprise Architecture
Introduction to Enterprise ArchitectureIntroduction to Enterprise Architecture
Introduction to Enterprise Architecture
Mohammed Omar
 
Web Security - Introduction v.1.3
Web Security - Introduction v.1.3Web Security - Introduction v.1.3
Web Security - Introduction v.1.3
Oles Seheda
 
Business Architecture Explained
Business Architecture ExplainedBusiness Architecture Explained
Business Architecture Explained
aaronwilliamson
 
Information security management
Information security managementInformation security management
Information security managementUMaine
 
It Service Management Implementation Overview
It Service Management Implementation OverviewIt Service Management Implementation Overview
It Service Management Implementation OverviewAlan McSweeney
 
ITSM (IT Service Management) & ITIL V3 Foundation
ITSM (IT Service Management) & ITIL V3 FoundationITSM (IT Service Management) & ITIL V3 Foundation
ITSM (IT Service Management) & ITIL V3 Foundation
PrudentialSolutions
 
Presentation about servers
Presentation about serversPresentation about servers
Presentation about servers
Sasin Prabu
 
Computer Security
Computer SecurityComputer Security
Computer Security
Frederik Questier
 

Viewers also liked (20)

Server Management
Server ManagementServer Management
Server Management
 
Rg0035 A Guideto Service Improvement Nhs Scotland
Rg0035 A Guideto Service Improvement Nhs ScotlandRg0035 A Guideto Service Improvement Nhs Scotland
Rg0035 A Guideto Service Improvement Nhs Scotland
 
Application Architecture Trends
Application Architecture TrendsApplication Architecture Trends
Application Architecture Trends
 
Developing and implementing asset lifecycle management strategies
Developing and implementing asset lifecycle management strategiesDeveloping and implementing asset lifecycle management strategies
Developing and implementing asset lifecycle management strategies
 
L01 Enterprise Application Architecture
L01 Enterprise Application ArchitectureL01 Enterprise Application Architecture
L01 Enterprise Application Architecture
 
Server training
Server trainingServer training
Server training
 
ITSM Presentation
ITSM PresentationITSM Presentation
ITSM Presentation
 
Application Architecture
Application ArchitectureApplication Architecture
Application Architecture
 
Types of server
Types of serverTypes of server
Types of server
 
Servers
ServersServers
Servers
 
Web Security
Web SecurityWeb Security
Web Security
 
What is a Server
What is a ServerWhat is a Server
What is a Server
 
Introduction to Enterprise Architecture
Introduction to Enterprise ArchitectureIntroduction to Enterprise Architecture
Introduction to Enterprise Architecture
 
Web Security - Introduction v.1.3
Web Security - Introduction v.1.3Web Security - Introduction v.1.3
Web Security - Introduction v.1.3
 
Business Architecture Explained
Business Architecture ExplainedBusiness Architecture Explained
Business Architecture Explained
 
Information security management
Information security managementInformation security management
Information security management
 
It Service Management Implementation Overview
It Service Management Implementation OverviewIt Service Management Implementation Overview
It Service Management Implementation Overview
 
ITSM (IT Service Management) & ITIL V3 Foundation
ITSM (IT Service Management) & ITIL V3 FoundationITSM (IT Service Management) & ITIL V3 Foundation
ITSM (IT Service Management) & ITIL V3 Foundation
 
Presentation about servers
Presentation about serversPresentation about servers
Presentation about servers
 
Computer Security
Computer SecurityComputer Security
Computer Security
 

Similar to Application architecture for the rest of us - php xperts devcon 2012

Azure and cloud design patterns
Azure and cloud design patternsAzure and cloud design patterns
Azure and cloud design patterns
Venkatesh Narayanan
 
AWS Summit 2011: Architecting in the cloud
AWS Summit 2011: Architecting in the cloudAWS Summit 2011: Architecting in the cloud
AWS Summit 2011: Architecting in the cloudAmazon Web Services
 
Scaling SQL and NoSQL Databases in the Cloud
Scaling SQL and NoSQL Databases in the Cloud Scaling SQL and NoSQL Databases in the Cloud
Scaling SQL and NoSQL Databases in the Cloud
RightScale
 
Modeling data and best practices for the Azure Cosmos DB.
Modeling data and best practices for the Azure Cosmos DB.Modeling data and best practices for the Azure Cosmos DB.
Modeling data and best practices for the Azure Cosmos DB.
Mohammad Asif
 
Scaling Your Database In The Cloud
Scaling Your Database In The CloudScaling Your Database In The Cloud
Scaling Your Database In The Cloud
Cory Isaacson
 
Escalando Aplicaciones Web
Escalando Aplicaciones WebEscalando Aplicaciones Web
Escalando Aplicaciones Web
Santiago Coffey
 
AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...
AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...
AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...
GeeksLab Odessa
 
SQL and NoSQL in SQL Server
SQL and NoSQL in SQL ServerSQL and NoSQL in SQL Server
SQL and NoSQL in SQL Server
Michael Rys
 
Clustering van IT-componenten
Clustering van IT-componentenClustering van IT-componenten
Clustering van IT-componenten
Richard Claassens CIPPE
 
عصر کلان داده، چرا و چگونه؟
عصر کلان داده، چرا و چگونه؟عصر کلان داده، چرا و چگونه؟
عصر کلان داده، چرا و چگونه؟
datastack
 
Using Data Lakes
Using Data LakesUsing Data Lakes
Using Data Lakes
Amazon Web Services
 
Microsoft Azure Cloud Basics Tutorial
Microsoft Azure Cloud Basics TutorialMicrosoft Azure Cloud Basics Tutorial
Microsoft Azure Cloud Basics Tutorial
IIMSE Edu
 
Big Data Essentials meetup @ IBM Ljubljana 23.06.2015
Big Data Essentials meetup @ IBM Ljubljana 23.06.2015Big Data Essentials meetup @ IBM Ljubljana 23.06.2015
Big Data Essentials meetup @ IBM Ljubljana 23.06.2015Andrey Vykhodtsev
 
Learning Cassandra NoSQL
Learning Cassandra NoSQLLearning Cassandra NoSQL
Learning Cassandra NoSQL
Pankaj Khattar
 
Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...
Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...
Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...
Kalaiselvan (Selvan)
 
Scaling Web Apps P Falcone
Scaling Web Apps P FalconeScaling Web Apps P Falcone
Scaling Web Apps P Falconejedt
 
Designing for Concurrency
Designing for ConcurrencyDesigning for Concurrency
Designing for Concurrency
Susan Potter
 
Overview of MongoDB and Other Non-Relational Databases
Overview of MongoDB and Other Non-Relational DatabasesOverview of MongoDB and Other Non-Relational Databases
Overview of MongoDB and Other Non-Relational Databases
Andrew Kandels
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
Kelum Senanayake
 

Similar to Application architecture for the rest of us - php xperts devcon 2012 (20)

Azure and cloud design patterns
Azure and cloud design patternsAzure and cloud design patterns
Azure and cloud design patterns
 
AWS Summit 2011: Architecting in the cloud
AWS Summit 2011: Architecting in the cloudAWS Summit 2011: Architecting in the cloud
AWS Summit 2011: Architecting in the cloud
 
Scaling SQL and NoSQL Databases in the Cloud
Scaling SQL and NoSQL Databases in the Cloud Scaling SQL and NoSQL Databases in the Cloud
Scaling SQL and NoSQL Databases in the Cloud
 
Modeling data and best practices for the Azure Cosmos DB.
Modeling data and best practices for the Azure Cosmos DB.Modeling data and best practices for the Azure Cosmos DB.
Modeling data and best practices for the Azure Cosmos DB.
 
Scaling Your Database In The Cloud
Scaling Your Database In The CloudScaling Your Database In The Cloud
Scaling Your Database In The Cloud
 
Nosql seminar
Nosql seminarNosql seminar
Nosql seminar
 
Escalando Aplicaciones Web
Escalando Aplicaciones WebEscalando Aplicaciones Web
Escalando Aplicaciones Web
 
AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...
AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...
AI&BigData Lab 2016. Сарапин Виктор: Размер имеет значение: анализ по требова...
 
SQL and NoSQL in SQL Server
SQL and NoSQL in SQL ServerSQL and NoSQL in SQL Server
SQL and NoSQL in SQL Server
 
Clustering van IT-componenten
Clustering van IT-componentenClustering van IT-componenten
Clustering van IT-componenten
 
عصر کلان داده، چرا و چگونه؟
عصر کلان داده، چرا و چگونه؟عصر کلان داده، چرا و چگونه؟
عصر کلان داده، چرا و چگونه؟
 
Using Data Lakes
Using Data LakesUsing Data Lakes
Using Data Lakes
 
Microsoft Azure Cloud Basics Tutorial
Microsoft Azure Cloud Basics TutorialMicrosoft Azure Cloud Basics Tutorial
Microsoft Azure Cloud Basics Tutorial
 
Big Data Essentials meetup @ IBM Ljubljana 23.06.2015
Big Data Essentials meetup @ IBM Ljubljana 23.06.2015Big Data Essentials meetup @ IBM Ljubljana 23.06.2015
Big Data Essentials meetup @ IBM Ljubljana 23.06.2015
 
Learning Cassandra NoSQL
Learning Cassandra NoSQLLearning Cassandra NoSQL
Learning Cassandra NoSQL
 
Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...
Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...
Silicon India Java Conference: Building Scalable Solutions For Commerce Silic...
 
Scaling Web Apps P Falcone
Scaling Web Apps P FalconeScaling Web Apps P Falcone
Scaling Web Apps P Falcone
 
Designing for Concurrency
Designing for ConcurrencyDesigning for Concurrency
Designing for Concurrency
 
Overview of MongoDB and Other Non-Relational Databases
Overview of MongoDB and Other Non-Relational DatabasesOverview of MongoDB and Other Non-Relational Databases
Overview of MongoDB and Other Non-Relational Databases
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
 

Recently uploaded

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 

Recently uploaded (20)

JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 

Application architecture for the rest of us - php xperts devcon 2012

  • 1. APPLICATION ARCHITECTURE FOR THE REST OF US Presented by M N Islam Shihan
  • 2. Introduction  Target Audience  What is Architecture?  Architecture is the foundation of your application  Applications are not like Sky Scrappers  Enterprise Vs Personal Architecture  Why look ahead in Architecture?  Adaptabilitywith Growth  Maintainability  Requirements never ends
  • 3. Enterprise Architecture (cont…)  Security  Responsiveness  Extendibility  Availability  Load Management  Distributed Computation  Caching  Scalability
  • 5. Security (cont…) Think about Security first of all  Network Security: Implement Firewall & Reverse Proxy for your network  SQL Injection: Never forget to escape field values in your queries  XSS (Cross Site Scripting): Never trust user provided (or grabbed from third party data sources) data and display without sanitizing/escaping  CSRF (Cross Site Request Forgery): Never let your forms to be submitted from third party sites
  • 6. Security (cont…)  DDOS (Distributed Daniel of Services): Enable real time monitoring of access to detect and prevent DDOS attacks  Session fixation: Implement session key regeneration for every request  Always hash your security tokens/cookies with new random salts per request/session basis (or in an interval)  Stay tuned and up-to-date with security news and releases of all of your used tools and technologies
  • 8. Responsiveness (cont…)  Web applications should be as responsive as Desktop Applications  Plan well and apply good use of JavaScript to achieve Responsiveness  Detect browsers and provide separate response/interface depending on detected browser type  Implement unobtrusive use of JavaScript  Implement optimal use of Ajax  Use Comet Programming instead of Polling  Implement deferred/asynchronous processing of large computations using Job Queue
  • 9. Extendibility  Implement and use robust data access interface, so that they can be exposed easily via web services (like REST, SOAP, JSONP)  Use architectural patterns & best practices  SOA(Service Oriented Architecture)  MVC (Model View Controller)  Modular architecture with plug-ability  Allow hooks and overrides through Events
  • 11. Availability (cont…)  Implement well planned Disaster Recovery policy  Use version control for your sources  Use RAID for your storage devices  Keep hot standby fallback for each of your primary data/content servers  Perform periodical backup of your source repository, files & data  Implement periodical archiving of your old data  Provide mechanism to the users to switch between current and archived data when possible
  • 13. Load Management (cont…)  Monitor and Benchmark your servers periodically and find pick usage time  Optimize to support at least 150% of pick time load  Use web servers with high I/O performance  Introduce load balancer to distribute loads among multiple application Servers  Start with software (aka. reverse proxy) then grow to use hardware load balancer only if necessary  Use CDNs to serve your static contents  Use public CDNs to serve the open source JavaScript or CSS files when possible
  • 14. Caching  To Cache Or Not to Cache?  Analyze the nature of content and response generated by your application very well  What to cache?  Analyze and set proper expiry time  Invalidate cache whenever content changes  Partial caching will also bring you speed  When caching is bad?  Understand various types of web caches  Browser cache  Proxy cache  Gateway cache
  • 15. Caching (cont…)  Implement server side caching  Runtime in-memory cache  Per request: Global variables  Shared: Memcached  Persistent Cache  Per Server: File based, APC  Shared: Db based, Redis  Optimizers and accelerators: eAccelerator, XCache  Reverse proxy/gateway cache  Varnish cache
  • 17. Scalability  What the heck is this?  Scalability is the soul of enterprise architecture  Scalability pyramid
  • 21. Scalability  Scaling up (vertical) vs. Scaling out (horizontal)
  • 22. Scalability  Database Scalability  Vertical: Add resource to server as needed  In most cases produce single point of failure  Horizontal: Distribute/replicate data among multiple servers  Cloud Services: Store your data to third party data centers and pay with respect to your usage
  • 23. Scalability (cont…) Scaling Database Scaling options  Master/Slave  Master for Write, Slaves for Read  Cluster Computing  Single storage with multiple server node  Table Partitioning  Large tables are split among partitions  Federated Tables  Tables are shared among multiple servers  Distributed Key Value Stores  Distributed Object DB  Database Sharding
  • 24. Scalability (cont…) Database Sharding  Smaller databases are easier to manage  Smaller databases are faster  Database sharding can reduce costs  Need one or multiple well define shard functions  "Don't do it, if you don't need to!" (37signals.com)  "Shard early and often!" (startuplessonslearned. blogspot.com)
  • 25. Scalability (cont…) Database Sharding When appropriate? What to analyze?  High-transaction database  Identify all transaction-intensive applications tables in your schema.  Mixed workload database usage  Determine the transaction volume  Frequent reads, including complex your database is currently handling queries and joins (or is expected to handle).  Write-intensive transactions (CRUD  Identify all common SQL statements statements, including INSERT, (SELECT, INSERT, UPDATE, UPDATE, DELETE) DELETE), and the volumes  Contention for common tables and/or associated with each. rows  Develop an understanding of your  General Business Reporting "table hierarchy" contained in your  Typical "repeating segment" report schema; in other words the main generation parent-child relationships.  Some data analysis (mixed with other  Determine the "key distribution" for workloads) transactions on high-volume tables, to determine if they are evenly spread or are concentrated in narrow ranges.
  • 26. Scalability (cont…) Database Sharding  Challenges  Reliability  Automated backups  Database Shard redundancy  Cost-effective hardware redundancy  Automated failover  Disaster Recovery  Distributed queries  Aggregation of statistics  Queries that support comprehensive reports
  • 27. Scalability (cont…) Database Sharding  Challenges (cont…)  Avoidance of cross-shard joins  Auto-increment key management  Support for multiple Shard Schemes  Session-based sharding  Transaction-based sharding  Statement-based sharding  Determine the optimum method for sharding the data  Shard by a primary key on a table  Shard by the modulus of a key value  Maintain a master shard index table
  • 28. Scalability (cont…) Database Sharding Example Bookstore schema showing how data is sharded
  • 29. Tools  Application framework  Load balancer with multiple application servers  Continuous integration  Automated Testing  TDD (Test Driven Development)  BDD (Behavior Driven Development)  Monitoring  Services  Servers  Error Logging  Access Logging  Content Data Networks (CDN)  FOSS
  • 31. Think Ahead (cont…)  Understand business model  Analyze requirement in greatest detail  Plan for extendibility  Be agile, do incremental architecture  Create/use frameworks  SQL or NoSQL?  Sharding or clustering or both?  Cloud services?
  • 32. Guidelines  Enrich your knowledge: Read, read & read. Read anything available : jokes to religions.  Follow patterns & best practices  Mix technologies  Don’t let your tools/technologies limit your vision  Invent/customize technology if required  Use FOSS  Don’t expect ready solutions  Find the closest match  Customize as needed
  • 33. Guidelines (cont…) Database Optimization  Use established & proven solutions  MySQL  PostgreSQL  MongoDB  Redis  Memchached  CouchDB  Understand and utilize indexing & full-text search  Use optimized DB structure & algorithms  Modified Preorder Tree Traversal (MPTT)  Map Reduce  ORM or not?
  • 34. Guidelines (cont…) Database Optimization  Optimize your queries  One big query is faster than repetitive smaller queries  Never be lazy to write optimized queries  One Ring to Rule `em All  Use Runtime In Memory Cache  Filtering in-memory cached dataset is much faster than executing a query in DB
  • 35. Guidelines (cont…) One Ring to Rule `em All Perform Selection, then Projection, then Join a_i d A B C 1,000 records 1000,000 records 1000,000,000 records A simple example Write a standard SQL query to find all records with fields A.a1, B.b1 and C.c1 from tables A (id, a1,a2, a3, …,aP), B (id, a_id, b1, b2, b3, …, bQ), and C(id, b_id, c1, c2, c3, …,cR) given that A.aX, B.bY and C.cZ will match ‘X’, ‘Y’ and ‘Z’ values respectively. Assume all tables A, B, C has primary keys defined by id column and a_id and b_id are the foreign keys in B from A and in C from B respectively.
  • 36. Guidelines One Ring to Rule `em All (cont…) Solution 1 SELECT A.a1, B.b1, C.c1 FROM A, B, C WHERE A.id = B.a_id AND B.id = C.b_id AND A.aX = ‘X’ AND B.bY = ‘Y’ AND C.cZ = ‘Z’ Why it Sucks? •Remembered the size of A, B and C tables? •Cross product of tables are always memory extensive, why? •A x B x C will have 1,000 x 1,000,000 x 1,000,000,000 records with (P +1) + (Q +2) + (R +2) fields •Can you imagine the size of in-memory result set of joined tables? •It will be HUGE
  • 37. Guidelines One Ring to Rule `em All (cont…) Solution 2 SELECT A.a1, B.b1, C.c1 FROM A INNER JOIN B ON A.id = B.a_id INNER JOIN C ON B.id = C.b_id WHERE A.aX = ‘X’ AND B.bY = ‘Y’ AND C.cZ = ‘Z’ Why it still Sucks? •A B C will produce (1,000 x 1,000,000) records to perform A B and then produce another (1,000 x 1,000,000,000) records to compute (A B) C and then it will filters the records defined by WHERE clause. •The number of fields, that is P+1 in A, Q+2 in B and R+2 in C will also contribute in memory consumption. •It is optimized but still be HUGE with respect to memory consumption and computation
  • 38. Guidelines One Ring to Rule `em All (cont…) Optimal Solution SELECT A.a1, B.b1, C.c1 FROM (SELECT id, a1 FROM A WHERE aX = ‘X’) as A INNER JOIN ( SELECT id, b1, a_id FROM B WHERE bY = ‘Y’) as B ON A.id = B.a_id INNER JOIN ( SELECT id, c1, b_id FROM C WHERE cZ = ‘Z’) as C ON B.id = Why this solution out performs? C.b_id •Let’s keep the explanation as an exercise 
  • 39. Reference : Tools  Security  Nmap: http://nmap.org/  Nikto: http://cirt.net/Nikto2  List of Tools: http://sectools.org/  Caching  APC: http://php.net/manual/en/book.apc.php  XCache: http://xcache.lighttpd.net/  eAccelerator: http://sourceforge.net/projects/eaccelerator/  Varnish Cache: https://www.varnish-cache.org/  MemCached: http://memcached.org/  Redis: http://redis.io/  Load Balancer  HAProxy: http://haproxy.1wt.eu/  Pound: http://www.apsis.ch/pound/
  • 40. Reference : Tools (cont…)  NoSQL  MongoDB: http://www.mongodb.org/  CouchDB: http://couchdb.apache.org/  A complete list: http://nosql-database.org/  Distributed Computing  GearMan: http://gearman.org/  Message Queue/Job Server  RabitMQ: http://www.rabbitmq.com/  ActiveMQ: http://activemq.apache.org/  Monitoring  Nagios: http://www.nagios.org/  Testing  Selenium: http://seleniumhq.org/  Cucumber: http://cukes.info/  Watir: http://watir.com/  PhpUnit: http://www.phpunit.de/manual/3.7/en/  MPTT  Shameless Promotion: https://github.com/mnishihan/phpMptt
  • 41. Reference : Articles  Caching  http://www.mnot.net/cache_docs/  http://bit.ly/9cTJfA  Load Balancing  http://en.wikipedia.org/wiki/Load_balancing_%28computing%29  http://1wt.eu/articles/2006_lb/index.html  Scalability & Architecture  http://www.diranieh.com/DistributedDesign_1/Scalability.htm  http://www.infoq.com/presentations/Facebook-Software-Stack  http://99designs.com/tech-blog/blog/2012/01/30/infrastructure-at-99designs/  http://bit.ly/16cKu  Database Sharding  http://www.codefutures.com/database-sharding/  http://bit.ly/Y3b3J  http://www.startuplessonslearned.com/2009/01/sharding-for-startups.html  CDN  http://bit.ly/sMRyxC  MPTT  http://www.sitepoint.com/hierarchical-data-database/
  • 42. Thank You Join phpXperts [http://bit.ly/phpxperts] Follow me on twitter [http://twitter.com/mnishihan] Subscribe in facebook [http://fb.me/mnishihan]
  • 43. Questions??? I will be glad to answer 