From f9580a077038214d4ebd31cdacefa3d0e098dce1 Mon Sep 17 00:00:00 2001 From: Vu Date: Sat, 27 Mar 2021 16:47:14 +0700 Subject: [PATCH] re-arrang follow table content --- ...ty.md => 01 Performance vs scalability.md} | 0 ...oughput.md => 02 Latency vs throughput.md} | 0 ...y.md => 03 Availability vs consistency.md} | 0 ...patterns.md => 04 Consistency patterns.md} | 0 ...atterns.md => 05 Availability patterns.md} | 49 ++++++++- ...ame system.md => 06 Domain name system.md} | 4 + ...work.md => 07 Content delivery network.md} | 0 .../{Load balancer.md => 08 Load balancer.md} | 0 ...r).md => 09 Reverse proxy (web server).md} | 0 ...ation layer.md => 10 Application layer.md} | 0 .../{Database.md => 11 Database.md} | 0 .../{Federation.md => 11-1 Federation.md} | 0 .../{Sharding.md => 11-1 Sharding.md} | 0 ...rmalization.md => 11-2 Denormalization.md} | 0 .../{SQL tuning.md => 11-3 SQL tuning.md} | 0 .../noat.cards/{NoSQL.md => 12 NoSQL.md} | 0 ...value store.md => 12-1 Key-value store.md} | 0 ...cument store.md => 12-2 Document store.md} | 0 ...umn store.md => 12-2 Wide column store.md} | 0 ...aph database.md => 12-3 Graph database.md} | 0 .../{SQL or NoSQL.md => 13 SQL or NoSQL.md} | 0 .../noat.cards/{Cache.md => 14 Cache.md} | 0 ...e locations.md => 14-1 Cache locations.md} | 0 ...> 14-2 Database caching, what to cache.md} | 0 .../{Cache-aside.md => 14-3 Cache-aside.md} | 0 ...Write-through.md => 14-4 Write-through.md} | 0 ...).md => 14-5 Write-behind (write-back).md} | 0 ...Refresh-ahead.md => 14-6 Refresh-ahead.md} | 0 .../{Asynchronism.md => 15 Asynchronism.md} | 0 .../{Communication.md => 16 Communication.md} | 0 ...6-1 Hypertext transfer protocol (HTTP).md} | 0 ...-2 Transmission control protocol (TCP).md} | 0 ...d => 16-3 User datagram protocol (UDP).md} | 0 ...md => 16-4 Remote procedure call (RPC).md} | 0 ... Representational state transfer (REST).md | 103 ++++++++++++++++++ .../{Security.md => 17 Security.md} | 0 ...ogrammer should know.md => 18 Appendix.md} | 35 +++++- resources/noat.cards/Base 62.md | 13 --- resources/noat.cards/MD5.md | 4 - .../Representational state transfer (REST).md | 35 ------ 40 files changed, 189 insertions(+), 54 deletions(-) rename resources/noat.cards/{Performance vs scalability.md => 01 Performance vs scalability.md} (100%) rename resources/noat.cards/{Latency vs throughput.md => 02 Latency vs throughput.md} (100%) rename resources/noat.cards/{Availability vs consistency.md => 03 Availability vs consistency.md} (100%) rename resources/noat.cards/{Consistency patterns.md => 04 Consistency patterns.md} (100%) rename resources/noat.cards/{Availability patterns.md => 05 Availability patterns.md} (70%) rename resources/noat.cards/{Domain name system.md => 06 Domain name system.md} (95%) rename resources/noat.cards/{Content delivery network.md => 07 Content delivery network.md} (100%) rename resources/noat.cards/{Load balancer.md => 08 Load balancer.md} (100%) rename resources/noat.cards/{Reverse proxy (web server).md => 09 Reverse proxy (web server).md} (100%) rename resources/noat.cards/{Application layer.md => 10 Application layer.md} (100%) rename resources/noat.cards/{Database.md => 11 Database.md} (100%) rename resources/noat.cards/{Federation.md => 11-1 Federation.md} (100%) rename resources/noat.cards/{Sharding.md => 11-1 Sharding.md} (100%) rename resources/noat.cards/{Denormalization.md => 11-2 Denormalization.md} (100%) rename resources/noat.cards/{SQL tuning.md => 11-3 SQL tuning.md} (100%) rename resources/noat.cards/{NoSQL.md => 12 NoSQL.md} (100%) rename resources/noat.cards/{Key-value store.md => 12-1 Key-value store.md} (100%) rename resources/noat.cards/{Document store.md => 12-2 Document store.md} (100%) rename resources/noat.cards/{Wide column store.md => 12-2 Wide column store.md} (100%) rename resources/noat.cards/{Graph database.md => 12-3 Graph database.md} (100%) rename resources/noat.cards/{SQL or NoSQL.md => 13 SQL or NoSQL.md} (100%) rename resources/noat.cards/{Cache.md => 14 Cache.md} (100%) rename resources/noat.cards/{Cache locations.md => 14-1 Cache locations.md} (100%) rename resources/noat.cards/{Database caching, what to cache.md => 14-2 Database caching, what to cache.md} (100%) rename resources/noat.cards/{Cache-aside.md => 14-3 Cache-aside.md} (100%) rename resources/noat.cards/{Write-through.md => 14-4 Write-through.md} (100%) rename resources/noat.cards/{Write-behind (write-back).md => 14-5 Write-behind (write-back).md} (100%) rename resources/noat.cards/{Refresh-ahead.md => 14-6 Refresh-ahead.md} (100%) rename resources/noat.cards/{Asynchronism.md => 15 Asynchronism.md} (100%) rename resources/noat.cards/{Communication.md => 16 Communication.md} (100%) rename resources/noat.cards/{Hypertext transfer protocol (HTTP).md => 16-1 Hypertext transfer protocol (HTTP).md} (100%) rename resources/noat.cards/{Transmission control protocol (TCP).md => 16-2 Transmission control protocol (TCP).md} (100%) rename resources/noat.cards/{User datagram protocol (UDP).md => 16-3 User datagram protocol (UDP).md} (100%) rename resources/noat.cards/{Remote procedure call (RPC).md => 16-4 Remote procedure call (RPC).md} (100%) create mode 100644 resources/noat.cards/16-5 Representational state transfer (REST).md rename resources/noat.cards/{Security.md => 17 Security.md} (100%) rename resources/noat.cards/{Latency numbers every programmer should know.md => 18 Appendix.md} (69%) delete mode 100644 resources/noat.cards/Base 62.md delete mode 100644 resources/noat.cards/Representational state transfer (REST).md diff --git a/resources/noat.cards/Performance vs scalability.md b/resources/noat.cards/01 Performance vs scalability.md similarity index 100% rename from resources/noat.cards/Performance vs scalability.md rename to resources/noat.cards/01 Performance vs scalability.md diff --git a/resources/noat.cards/Latency vs throughput.md b/resources/noat.cards/02 Latency vs throughput.md similarity index 100% rename from resources/noat.cards/Latency vs throughput.md rename to resources/noat.cards/02 Latency vs throughput.md diff --git a/resources/noat.cards/Availability vs consistency.md b/resources/noat.cards/03 Availability vs consistency.md similarity index 100% rename from resources/noat.cards/Availability vs consistency.md rename to resources/noat.cards/03 Availability vs consistency.md diff --git a/resources/noat.cards/Consistency patterns.md b/resources/noat.cards/04 Consistency patterns.md similarity index 100% rename from resources/noat.cards/Consistency patterns.md rename to resources/noat.cards/04 Consistency patterns.md diff --git a/resources/noat.cards/Availability patterns.md b/resources/noat.cards/05 Availability patterns.md similarity index 70% rename from resources/noat.cards/Availability patterns.md rename to resources/noat.cards/05 Availability patterns.md index d413f065..6c8b0938 100644 --- a/resources/noat.cards/Availability patterns.md +++ b/resources/noat.cards/05 Availability patterns.md @@ -68,4 +68,51 @@ Both masters serve reads and writes and coordinate with each other on writes. If ## Source(s) and further reading: replication - [Scalability, availability, stability, patterns](http://www.slideshare.net/jboner/scalability-availability-stability-patterns/) -- [Multi-master replication](https://en.wikipedia.org/wiki/Multi-master_replication) \ No newline at end of file +- [Multi-master replication](https://en.wikipedia.org/wiki/Multi-master_replication) + + +## Availability in numbers + +Availability is often quantified by uptime (or downtime) as a percentage of time the service is available. Availability is generally measured in number of 9s--a service with 99.99% availability is described as having four 9s. + +## 99.9% availability - three 9s + +| Duration | Acceptable downtime| +|---------------------|--------------------| +| Downtime per year | 8h 45min 57s | +| Downtime per month | 43m 49.7s | +| Downtime per week | 10m 4.8s | +| Downtime per day | 1m 26.4s | + +## 99.99% availability - four 9s + +| Duration | Acceptable downtime| +|---------------------|--------------------| +| Downtime per year | 52min 35.7s | +| Downtime per month | 4m 23s | +| Downtime per week | 1m 5s | +| Downtime per day | 8.6s | + +## Availability in parallel vs in sequence + +If a service consists of multiple components prone to failure, the service's overall availability depends on whether the components are in sequence or in parallel. + +## In sequence + +Overall availability decreases when two components with availability < 100% are in sequence: + +``` +Availability (Total) = Availability (Foo) * Availability (Bar) +``` + +If both `Foo` and `Bar` each had 99.9% availability, their total availability in sequence would be 99.8%. + +## In parallel + +Overall availability increases when two components with availability < 100% are in parallel: + +``` +Availability (Total) = 1 - (1 - Availability (Foo)) * (1 - Availability (Bar)) +``` + +If both `Foo` and `Bar` each had 99.9% availability, their total availability in parallel would be 99.9999%. diff --git a/resources/noat.cards/Domain name system.md b/resources/noat.cards/06 Domain name system.md similarity index 95% rename from resources/noat.cards/Domain name system.md rename to resources/noat.cards/06 Domain name system.md index fc7b2fb4..9c80e041 100644 --- a/resources/noat.cards/Domain name system.md +++ b/resources/noat.cards/06 Domain name system.md @@ -14,11 +14,15 @@ A Domain Name System (DNS) translates a domain name such as [www.example.com](ht DNS is hierarchical, with a few authoritative servers at the top level. Your router or ISP provides information about which DNS server(s) to contact when doing a lookup. Lower level DNS servers cache mappings, which could become stale due to DNS propagation delays. DNS results can also be cached by your browser or OS for a certain period of time, determined by the [time to live (TTL) ](https://en.wikipedia.org/wiki/Time_to_live) . +## DNS record types + - NS record (name server) - Specifies the DNS servers for your domain/subdomain. - MX record (mail exchange) - Specifies the mail servers for accepting messages. - A record (address) - Points a name to an IP address. - CNAME (canonical) - Points a name to another name or `CNAME` (example.com to [www.example.com](http://www.example.com/)) or to an `A`record. +## DNS traffic route methods + Services such as [CloudFlare](https://www.cloudflare.com/dns/) and [Route 53](https://aws.amazon.com/route53/) provide managed DNS services. Some DNS services can route traffic through various methods: - [Weighted round robin](http://g33kinfo.com/info/archives/2657) diff --git a/resources/noat.cards/Content delivery network.md b/resources/noat.cards/07 Content delivery network.md similarity index 100% rename from resources/noat.cards/Content delivery network.md rename to resources/noat.cards/07 Content delivery network.md diff --git a/resources/noat.cards/Load balancer.md b/resources/noat.cards/08 Load balancer.md similarity index 100% rename from resources/noat.cards/Load balancer.md rename to resources/noat.cards/08 Load balancer.md diff --git a/resources/noat.cards/Reverse proxy (web server).md b/resources/noat.cards/09 Reverse proxy (web server).md similarity index 100% rename from resources/noat.cards/Reverse proxy (web server).md rename to resources/noat.cards/09 Reverse proxy (web server).md diff --git a/resources/noat.cards/Application layer.md b/resources/noat.cards/10 Application layer.md similarity index 100% rename from resources/noat.cards/Application layer.md rename to resources/noat.cards/10 Application layer.md diff --git a/resources/noat.cards/Database.md b/resources/noat.cards/11 Database.md similarity index 100% rename from resources/noat.cards/Database.md rename to resources/noat.cards/11 Database.md diff --git a/resources/noat.cards/Federation.md b/resources/noat.cards/11-1 Federation.md similarity index 100% rename from resources/noat.cards/Federation.md rename to resources/noat.cards/11-1 Federation.md diff --git a/resources/noat.cards/Sharding.md b/resources/noat.cards/11-1 Sharding.md similarity index 100% rename from resources/noat.cards/Sharding.md rename to resources/noat.cards/11-1 Sharding.md diff --git a/resources/noat.cards/Denormalization.md b/resources/noat.cards/11-2 Denormalization.md similarity index 100% rename from resources/noat.cards/Denormalization.md rename to resources/noat.cards/11-2 Denormalization.md diff --git a/resources/noat.cards/SQL tuning.md b/resources/noat.cards/11-3 SQL tuning.md similarity index 100% rename from resources/noat.cards/SQL tuning.md rename to resources/noat.cards/11-3 SQL tuning.md diff --git a/resources/noat.cards/NoSQL.md b/resources/noat.cards/12 NoSQL.md similarity index 100% rename from resources/noat.cards/NoSQL.md rename to resources/noat.cards/12 NoSQL.md diff --git a/resources/noat.cards/Key-value store.md b/resources/noat.cards/12-1 Key-value store.md similarity index 100% rename from resources/noat.cards/Key-value store.md rename to resources/noat.cards/12-1 Key-value store.md diff --git a/resources/noat.cards/Document store.md b/resources/noat.cards/12-2 Document store.md similarity index 100% rename from resources/noat.cards/Document store.md rename to resources/noat.cards/12-2 Document store.md diff --git a/resources/noat.cards/Wide column store.md b/resources/noat.cards/12-2 Wide column store.md similarity index 100% rename from resources/noat.cards/Wide column store.md rename to resources/noat.cards/12-2 Wide column store.md diff --git a/resources/noat.cards/Graph database.md b/resources/noat.cards/12-3 Graph database.md similarity index 100% rename from resources/noat.cards/Graph database.md rename to resources/noat.cards/12-3 Graph database.md diff --git a/resources/noat.cards/SQL or NoSQL.md b/resources/noat.cards/13 SQL or NoSQL.md similarity index 100% rename from resources/noat.cards/SQL or NoSQL.md rename to resources/noat.cards/13 SQL or NoSQL.md diff --git a/resources/noat.cards/Cache.md b/resources/noat.cards/14 Cache.md similarity index 100% rename from resources/noat.cards/Cache.md rename to resources/noat.cards/14 Cache.md diff --git a/resources/noat.cards/Cache locations.md b/resources/noat.cards/14-1 Cache locations.md similarity index 100% rename from resources/noat.cards/Cache locations.md rename to resources/noat.cards/14-1 Cache locations.md diff --git a/resources/noat.cards/Database caching, what to cache.md b/resources/noat.cards/14-2 Database caching, what to cache.md similarity index 100% rename from resources/noat.cards/Database caching, what to cache.md rename to resources/noat.cards/14-2 Database caching, what to cache.md diff --git a/resources/noat.cards/Cache-aside.md b/resources/noat.cards/14-3 Cache-aside.md similarity index 100% rename from resources/noat.cards/Cache-aside.md rename to resources/noat.cards/14-3 Cache-aside.md diff --git a/resources/noat.cards/Write-through.md b/resources/noat.cards/14-4 Write-through.md similarity index 100% rename from resources/noat.cards/Write-through.md rename to resources/noat.cards/14-4 Write-through.md diff --git a/resources/noat.cards/Write-behind (write-back).md b/resources/noat.cards/14-5 Write-behind (write-back).md similarity index 100% rename from resources/noat.cards/Write-behind (write-back).md rename to resources/noat.cards/14-5 Write-behind (write-back).md diff --git a/resources/noat.cards/Refresh-ahead.md b/resources/noat.cards/14-6 Refresh-ahead.md similarity index 100% rename from resources/noat.cards/Refresh-ahead.md rename to resources/noat.cards/14-6 Refresh-ahead.md diff --git a/resources/noat.cards/Asynchronism.md b/resources/noat.cards/15 Asynchronism.md similarity index 100% rename from resources/noat.cards/Asynchronism.md rename to resources/noat.cards/15 Asynchronism.md diff --git a/resources/noat.cards/Communication.md b/resources/noat.cards/16 Communication.md similarity index 100% rename from resources/noat.cards/Communication.md rename to resources/noat.cards/16 Communication.md diff --git a/resources/noat.cards/Hypertext transfer protocol (HTTP).md b/resources/noat.cards/16-1 Hypertext transfer protocol (HTTP).md similarity index 100% rename from resources/noat.cards/Hypertext transfer protocol (HTTP).md rename to resources/noat.cards/16-1 Hypertext transfer protocol (HTTP).md diff --git a/resources/noat.cards/Transmission control protocol (TCP).md b/resources/noat.cards/16-2 Transmission control protocol (TCP).md similarity index 100% rename from resources/noat.cards/Transmission control protocol (TCP).md rename to resources/noat.cards/16-2 Transmission control protocol (TCP).md diff --git a/resources/noat.cards/User datagram protocol (UDP).md b/resources/noat.cards/16-3 User datagram protocol (UDP).md similarity index 100% rename from resources/noat.cards/User datagram protocol (UDP).md rename to resources/noat.cards/16-3 User datagram protocol (UDP).md diff --git a/resources/noat.cards/Remote procedure call (RPC).md b/resources/noat.cards/16-4 Remote procedure call (RPC).md similarity index 100% rename from resources/noat.cards/Remote procedure call (RPC).md rename to resources/noat.cards/16-4 Remote procedure call (RPC).md diff --git a/resources/noat.cards/16-5 Representational state transfer (REST).md b/resources/noat.cards/16-5 Representational state transfer (REST).md new file mode 100644 index 00000000..8681782a --- /dev/null +++ b/resources/noat.cards/16-5 Representational state transfer (REST).md @@ -0,0 +1,103 @@ ++++ noatcards = True isdraft = False +++ + +# Representational state transfer (REST) + +## Representational state transfer introduction + +REST is an architectural style enforcing a client/server model where the client acts on a set of resources managed by +the server. The server provides a representation of resources and actions that can either manipulate or get a new +representation of resources. All communication must be stateless and cacheable. + +## RESTful interface + +There are four qualities of a RESTful interface: + +- Identify resources (URI in HTTP) - use the same URI regardless of any operation. +- Change with representations (Verbs in HTTP) - use verbs, headers, and body. +- Self-descriptive error message (status response in HTTP) - Use status codes, don't reinvent the wheel. +- [HATEOAS](http://restcookbook.com/Basics/hateoas/) (HTML interface for HTTP) - your web service should be fully + accessible in a browser. + +Sample REST calls: + +``` + GET /someresources/anId + + PUT /someresources/anId + {"anotherdata": "another value"} +``` + +REST is focused on exposing data. It minimizes the coupling between client/server and is often used for public HTTP +APIs. REST uses a more generic and uniform method of exposing resources through +URIs, [representation through headers](https://github.com/for-GET/know-your-http-well/blob/master/headers.md) , and +actions through verbs such as GET, POST, PUT, DELETE, and PATCH. Being stateless, REST is great for horizontal scaling +and partitioning. + +## Disadvantage(s) : REST + +- With REST being focused on exposing data, it might not be a good fit if resources are not naturally organized or + accessed in a simple hierarchy. For example, returning all updated records from the past hour matching a particular + set of events is not easily expressed as a path. With REST, it is likely to be implemented with a combination of URI + path, query parameters, and possibly the request body. +- REST typically relies on a few verbs (GET, POST, PUT, DELETE, and PATCH) which sometimes doesn't fit your use case. + For example, moving expired documents to the archive folder might not cleanly fit within these verbs. + +## What is HATEOAS and why is it important for my REST API? +-------------------------------------------------------- + +HATEOAS stands for **Hypertext As The Engine Of Application State**. It means that hypertext should be used to find your +way through the API. An example: + +``` +GET /account/12345 HTTP/1.1 + +HTTP/1.1 200 OK + + + 12345 + 100.00 + + + + + +``` + +Apart from the fact that we have 100 dollars (US) in our account, we can see 4 options: deposit more money, withdraw +money, transfer money to another account, or close our account. The "link"-tags allows us to find out the URLs that are +needed for the specified actions. Now, let's suppose we didn't have 100 usd in the bank, but we actually are in the red: + +``` + GET /account/12345 HTTP/1.1 + + HTTP/1.1 200 OK + + + 12345 + -25.00 + + +``` + +Now we are 25 dollars in the red. Do you see that right now we have lost many of our options, and only depositing money +is valid? As long as we are in the red, we cannot close our account, nor transfer or withdraw any money from the +account. The hypertext is actually telling us what is allowed and what not: HATEOAS + +## RPC and REST calls comparison + +| Operation | RPC | REST | +|---|---|---| +| Signup | **POST** /signup | **POST** /persons | +| Resign | **POST** /resign
{
"personid": "1234"
} | **DELETE** /persons/1234 | +| Read a person | **GET** /readPerson?personid=1234 | **GET** /persons/1234 | +| Read a person’s items list | **GET** /readUsersItemsList?personid=1234 | **GET** /persons/1234/items | +| Add an item to a person’s items | ** +POST** /addItemToUsersItemsList
{
"personid": "1234";
"itemid": "456"
} | ** +POST** /persons/1234/items
{
"itemid": "456"
} | +| Update an item | **POST** /modifyItem
{
"itemid": "456";
"key": "value"
} | ** +PUT** /items/456
{
"key": "value"
} | +| Delete an item | **POST** /removeItem
{
"itemid": "456"
} | **DELETE** /items/456 | + +

+ Source: Do you really know why you prefer REST over RPC +

\ No newline at end of file diff --git a/resources/noat.cards/Security.md b/resources/noat.cards/17 Security.md similarity index 100% rename from resources/noat.cards/Security.md rename to resources/noat.cards/17 Security.md diff --git a/resources/noat.cards/Latency numbers every programmer should know.md b/resources/noat.cards/18 Appendix.md similarity index 69% rename from resources/noat.cards/Latency numbers every programmer should know.md rename to resources/noat.cards/18 Appendix.md index 437a779c..dc753204 100644 --- a/resources/noat.cards/Latency numbers every programmer should know.md +++ b/resources/noat.cards/18 Appendix.md @@ -1,3 +1,25 @@ +# Appendix + +## Powers of two table + +``` +Power Exact Value Approx Value Bytes +--------------------------------------------------------------- +7 128 +8 256 +10 1024 1 thousand 1 KB +16 65,536 64 KB +20 1,048,576 1 million 1 MB +30 1,073,741,824 1 billion 1 GB +32 4,294,967,296 4 GB +40 1,099,511,627,776 1 trillion 1 TB +``` + +## Source(s) and further reading + +- [Powers of two](https://en.wikipedia.org/wiki/Power_of_two) + + ## Latency numbers every programmer should know --- Latency Comparison Numbers @@ -43,4 +65,15 @@ Handy metrics based on numbers above: - [Latency numbers every programmer should know - 1](https://gist.github.com/jboner/2841832) - [Latency numbers every programmer should know - 2](https://gist.github.com/hellerbarde/2843375) - [Designs, lessons, and advice from building large distributed systems](http://www.cs.cornell.edu/projects/ladis2009/talks/dean-keynote-ladis2009.pdf) -- [Software Engineering Advice from Building Large-Scale Distributed Systems](https://static.googleusercontent.com/media/research.google.com/en//people/jeff/stanford-295-talk.pdf) \ No newline at end of file +- [Software Engineering Advice from Building Large-Scale Distributed Systems](https://static.googleusercontent.com/media/research.google.com/en//people/jeff/stanford-295-talk.pdf) + + +## Introduction of base 62 +- Encodes to `[a-zA-Z0-9]` which works well for urls, eliminating the need for escaping special characters +- Only one hash result for the original input and and the operation is deterministic (no randomness involved) +- Base 64 is another popular encoding but provides issues for urls because of the additional `+` and `/` characters + +## MD5 + +- Widely used hashing function that produces a 128-bit hash value +- Uniformly distributed \ No newline at end of file diff --git a/resources/noat.cards/Base 62.md b/resources/noat.cards/Base 62.md deleted file mode 100644 index e82cca21..00000000 --- a/resources/noat.cards/Base 62.md +++ /dev/null @@ -1,13 +0,0 @@ -+++ -noatcards = True -isdraft = False -+++ - - -# Base 62 ---- - -## Introduction of base 62 -- Encodes to `[a-zA-Z0-9]` which works well for urls, eliminating the need for escaping special characters -- Only one hash result for the original input and and the operation is deterministic (no randomness involved) -- Base 64 is another popular encoding but provides issues for urls because of the additional `+` and `/` characters \ No newline at end of file diff --git a/resources/noat.cards/MD5.md b/resources/noat.cards/MD5.md index ae14d468..409c781b 100644 --- a/resources/noat.cards/MD5.md +++ b/resources/noat.cards/MD5.md @@ -3,7 +3,3 @@ noatcards = True isdraft = False +++ -MD5 ---- -- Widely used hashing function that produces a 128-bit hash value -- Uniformly distributed \ No newline at end of file diff --git a/resources/noat.cards/Representational state transfer (REST).md b/resources/noat.cards/Representational state transfer (REST).md deleted file mode 100644 index 50a4f61f..00000000 --- a/resources/noat.cards/Representational state transfer (REST).md +++ /dev/null @@ -1,35 +0,0 @@ -+++ -noatcards = True -isdraft = False -+++ - -# Representational state transfer (REST) - -## Representational state transfer introduction - -REST is an architectural style enforcing a client/server model where the client acts on a set of resources managed by the server. The server provides a representation of resources and actions that can either manipulate or get a new representation of resources. All communication must be stateless and cacheable. - -## RESTful interface - -There are four qualities of a RESTful interface: - -- Identify resources (URI in HTTP) - use the same URI regardless of any operation. -- Change with representations (Verbs in HTTP) - use verbs, headers, and body. -- Self-descriptive error message (status response in HTTP) - Use status codes, don't reinvent the wheel. -- [HATEOAS](http://restcookbook.com/Basics/hateoas/) (HTML interface for HTTP) - your web service should be fully accessible in a browser. - -Sample REST calls: - -``` - GET /someresources/anId - - PUT /someresources/anId - {"anotherdata": "another value"} -``` - -REST is focused on exposing data. It minimizes the coupling between client/server and is often used for public HTTP APIs. REST uses a more generic and uniform method of exposing resources through URIs, [representation through headers](https://github.com/for-GET/know-your-http-well/blob/master/headers.md) , and actions through verbs such as GET, POST, PUT, DELETE, and PATCH. Being stateless, REST is great for horizontal scaling and partitioning. - -## Disadvantage(s) : REST - -- With REST being focused on exposing data, it might not be a good fit if resources are not naturally organized or accessed in a simple hierarchy. For example, returning all updated records from the past hour matching a particular set of events is not easily expressed as a path. With REST, it is likely to be implemented with a combination of URI path, query parameters, and possibly the request body. -- REST typically relies on a few verbs (GET, POST, PUT, DELETE, and PATCH) which sometimes doesn't fit your use case. For example, moving expired documents to the archive folder might not cleanly fit within these verbs. \ No newline at end of file