AJAX & Web Application Scalability

studied byStudied by 0 people
0.0(0)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

1 / 24

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

25 Terms

1

what is AJAX?

  • asynchronous javascript and xml

    • combination of javascript and XMLHttpRequest API

    • used to generate HTTP requests on the background without having to load the complete document again

New cards
2

what is the main problem with using web browsers generated requests when interacting with client-side javascript programs?

the mechanism involves javascript tricking the web browser to generate HTTP requests to set the src attribute, img, and script

  • this caused problems with portability

New cards
3

What does the XMLHttpRequest API do?

provides an easier method for client-side javascript programs to make HTTP requests and process their responses

New cards
4

What is the three step process to using XMLHttpRequest?

  1. create an XMLHttpRequest object

  2. define and send the HTTP message to the server

  3. receive (synchronously and asynchronously) the server response

New cards
5

How are exchanged messages formatted in the XMLHttpRequest API nowadays?

  • usually formatted in JSON

  • sometimes plain text, HTML, or XML

New cards
6

What is the mechanism for asynchronous requests?

  1. data is sent with the send method

    • send method returns a response immediately without waiting for the request’s response

  2. callback function is registered

    • it is called by the browser each time the request status changes (i.e readyState property changes)

New cards
7

What are the different values for the readyState property and what do they mean?

  • readyState 0: not initialized

  • readyState 1: connection lost

  • readyState 2: request received

  • readyState 3: request being processed

  • readyState == 4: response received.

New cards
8

How can we use JQuery (a js library) with the XMLHttpRequest API?

JQuery provides user friendly functions:

  1. low level functions

    • $.ajax()

  2. high-level method

    • load()

  3. high level functions

    • $.getScript()

    • $.getJSON()

    • $.get()

    • $.post()

New cards
9

What does the load method do?

  • it can be used to select and load elements of a document

  • it can be used to select and load a section of a document

  • we can define a function that will be run when the load operation has finished

    • error functions for when a selection fails can be customized

<ul><li><p>it can be used to select and load elements of a document</p></li><li><p>it can be used to select and load a section of a document</p></li><li><p>we can define a function that will be run when the load operation has finished</p><ul><li><p>error functions for when a selection fails can be customized</p></li></ul></li></ul>
New cards
10

What does the function $.getJSON() do?

  • it can be used to load a JSON object

    • later functions defined can use the JSON variable

  • parameters can be sent in the request for matching

  • error functions can be customized with the .fail() function

<ul><li><p>it can be used to load a JSON object</p><ul><li><p>later functions defined can use the JSON variable </p></li></ul></li><li><p>parameters can be sent in the request for matching</p></li><li><p>error functions can be customized with the .fail() function</p></li></ul>
New cards
11

What does the function $.get() do?

  • loads an object automatically

    • interpreted automatically as either JSON, XML, HTML, or plain text

<ul><li><p>loads an object automatically</p><ul><li><p>interpreted automatically as either JSON, XML, HTML, or plain text</p></li></ul></li></ul>
New cards
12

What does the function $.post() do?

  • it can send data to the target object with a POST method

    • parameters can be specified

  • it can send data to a form (using class name) with a POST method

  • it can process HTTP responses

<ul><li><p>it can send data to the target object with a POST method</p><ul><li><p>parameters can be specified</p></li></ul></li><li><p>it can send data to a form (using class name) with a POST method</p></li><li><p>it can process HTTP responses</p></li></ul>
New cards
13

What does scalability mean?

refers to the capacity of the infrastructure of a server hosting a web application to handle growing workload (request rate, amount of users, etc)

New cards
14

What is cache memory?

New cards
15

How does cache memory reduce the load of the webserver and database management?

  • it removes the need to rebuild HTML pages that have been built recently

  • it removes the need to fetch data from the database if those have been queried recently

New cards
16

What are the different ways to cache web servers?

  1. caching web pages in front of a web server (reverse proxies)

    • server that sits in front of web servers and forwards client (eg web browser) requests to those web servers

  2. distributed RAM-caching systems (mem-cached)

    • stores already generated HTML fragments

    • stores objects obtained from database

New cards
17

How do we scale a webpage when caching isn’t enough?

computational resources can be increased

New cards
18

What are the two ways we can scale a web page by increasing resouces?

  1. Vertical Scalability

    • improving hardware used for web-server and database system (i.e better CPUs, more RAM, more disk space etc)

  2. Horizontal Scalability

    • adding more servers (web or database) without improving their individual capacity

New cards
19

What is ‘horizontal scalability’ of web servers?

main idea: deploying several web servers and distributing requests among them

  • DNS load balancing: one domain name is connected to several IP addresses

  • load balancing with front-end servers (handling user requests, such as serving web pages, processing application logic, handling API calls)

New cards
20

How do we partition tasks versus data?

  • tasks: each web server is in charge of certain tasks

    • attention to session management

  • data: each database server stores a subset of the data

    • so that each task can be executed within just one database server

New cards
21

What are the two types of data partitioning?

  1. by data entity

    • e.g customers in one server, sales in another server, accounting in another…

  2. by subsets within the same entity by feature

    • e.g dividing customers by location, gender etc in diff servers

New cards
22

What should be done in situations where the read operations are a lot more frequent than write operations?

Use a master database server with several slave servers for data reading

New cards
23

What are ACID restrictions?

atomicity, consistency, isolation, durability

  • property of database transactions to guarantee data validity

New cards
24

What is one way we can distribute data more efficiently?

  • use NoSQL databases (relax ACID restrictions)

New cards
25

What are the 4 types of NoSQL databases?

  1. Key-Value Store

    • redis, dynamoDB, berkeleyDB

  2. Wide Column Store

    • cassandra, hbase (hadoop)

  3. Document Store

    • mongoDB, couchDB

  4. Graph Database

    • Neo4J, OpenLink Virtuoso

New cards
robot