Forwarded from Bardia
package main
func f(vs ...interface{}) { print(len(vs)) } func main() { f() f(nil) f(nil...) }
func f(vs ...interface{}) { print(len(vs)) } func main() { f() f(nil) f(nil...) }
Anonymous Quiz
40%
0 0 0
31%
0 1 0
25%
0 1 1
4%
1 1 0
π1
What are the API architectural styles?
The diagram below shows the common API architectural styles in one picture.
πΉ 1. REST
Proposed in 2000, REST is the most used style. It is often used between front-end clients and back-end services. It is compliant with 6 architectural constraints. The payload format can be JSON, XML, HTML, or plain text.
πΉ 2. GraphQL
GraphQL was proposed in 2015 by Meta. It provides a schema and type system, suitable for complex systems where the relationships between entities are graph-like. For example, in the diagram below, GraphQL can retrieve user and order information in one call, while in REST this needs multiple calls.
GraphQL is not a replacement for REST. It can be built upon existing REST services.
πΉ 3. Web socket
Web socket is a protocol that provides full-duplex communications over TCP. The clients establish web sockets to receive real-time updates from the back-end services. Unlike REST, which always βpullsβ data, web socket enables data to be βpushedβ.
πΉ 4. Webhook
Webhooks are usually used by third-party asynchronous API calls. we use Stripe or Paypal for payment channels and register a webhook for payment results. When a third-party payment service is done, it notifies the payment service if the payment is successful or failed. Webhook calls are usually part of the systemβs state machine.
πΉ 5. gRPC
Released in 2016, gRPC is used for communications among microservices. gRPC library handles encoding/decoding and data transmission.
πΉ 6. SOAP
SOAP stands for Simple Object Access Protocol. Its payload is XML only, suitable for communications between internal systems.
βββββββββ
π° @gopher_academy
The diagram below shows the common API architectural styles in one picture.
πΉ 1. REST
Proposed in 2000, REST is the most used style. It is often used between front-end clients and back-end services. It is compliant with 6 architectural constraints. The payload format can be JSON, XML, HTML, or plain text.
πΉ 2. GraphQL
GraphQL was proposed in 2015 by Meta. It provides a schema and type system, suitable for complex systems where the relationships between entities are graph-like. For example, in the diagram below, GraphQL can retrieve user and order information in one call, while in REST this needs multiple calls.
GraphQL is not a replacement for REST. It can be built upon existing REST services.
πΉ 3. Web socket
Web socket is a protocol that provides full-duplex communications over TCP. The clients establish web sockets to receive real-time updates from the back-end services. Unlike REST, which always βpullsβ data, web socket enables data to be βpushedβ.
πΉ 4. Webhook
Webhooks are usually used by third-party asynchronous API calls. we use Stripe or Paypal for payment channels and register a webhook for payment results. When a third-party payment service is done, it notifies the payment service if the payment is successful or failed. Webhook calls are usually part of the systemβs state machine.
πΉ 5. gRPC
Released in 2016, gRPC is used for communications among microservices. gRPC library handles encoding/decoding and data transmission.
πΉ 6. SOAP
SOAP stands for Simple Object Access Protocol. Its payload is XML only, suitable for communications between internal systems.
βββββββββ
π° @gopher_academy
π8
1677600752047.pdf
5.6 MB
12 Critical Strategies of System Design
- Design For Failure
- Redundancy And Fault Recovery
- Single-Version Software
- Multi-tenancy
- Quick Service Health Check
- Develop In The Full Environment
- Zero Trust in Underlying Components
- Do Not Build the Same Functionality in Multiple Components
- One Cluster Should Not Affect Another Cluster
- Allow (rare) Emergency Human Intervention.
- Keep Things Simple And Robust
- Enforce Admission Control At All Levels
βββββββββ
π° @gopher_academy
- Design For Failure
- Redundancy And Fault Recovery
- Single-Version Software
- Multi-tenancy
- Quick Service Health Check
- Develop In The Full Environment
- Zero Trust in Underlying Components
- Do Not Build the Same Functionality in Multiple Components
- One Cluster Should Not Affect Another Cluster
- Allow (rare) Emergency Human Intervention.
- Keep Things Simple And Robust
- Enforce Admission Control At All Levels
βββββββββ
π° @gopher_academy
π₯2π1
The diagram below shows the differences between a forward proxy and a reverse proxy.
A ππ¨π«π°ππ«π π©π«π¨π±π² is a server that sits between user devices and the internet.
A forward proxy is commonly used for:
- Protect clients
- Avoid browsing restrictions
- Block access to certain content
A π«ππ―ππ«π¬π π©π«π¨π±π² is a server that accepts a request from the client, forwards the request to web servers, and returns the results to the client as if the proxy server had processed the request.
A reverse proxy is good for:
- Protect servers
- Load balancing
- Cache static contents
- Encrypt and decrypt SSL communications
βββββββββ
π° @gopher_academy
A ππ¨π«π°ππ«π π©π«π¨π±π² is a server that sits between user devices and the internet.
A forward proxy is commonly used for:
- Protect clients
- Avoid browsing restrictions
- Block access to certain content
A π«ππ―ππ«π¬π π©π«π¨π±π² is a server that accepts a request from the client, forwards the request to web servers, and returns the results to the client as if the proxy server had processed the request.
A reverse proxy is good for:
- Protect servers
- Load balancing
- Cache static contents
- Encrypt and decrypt SSL communications
βββββββββ
π° @gopher_academy
π2
1677498728649.pdf
13.9 MB
How do you gracefully shut down Pods without dropping traffic?
#kubernetes
βββββββββ
π° @gopher_academy
#kubernetes
βββββββββ
π° @gopher_academy
π³2
1677126905817.pdf
1.6 MB
ππππ€-ππ§π πππ―ππ₯π¨π©ππ« ππ¨πππ¦ππ© π‘
βββββββββ
π° @gopher_academy
βββββββββ
π° @gopher_academy
β€8π2
β We don't write tests.
β Why?
β Because we donβt have time for it.
β Why?
β Because there is too much work and pressure.
β Why?
β Because we donβt move fast enough.
β Why?
β Because changing software has become difficult and risky.
β Why?
β Because we donβt write tests.
βββββββββ
π° @gopher_academy
β Why?
β Because we donβt have time for it.
β Why?
β Because there is too much work and pressure.
β Why?
β Because we donβt move fast enough.
β Why?
β Because changing software has become difficult and risky.
β Why?
β Because we donβt write tests.
βββββββββ
π° @gopher_academy
π€£16π1
Types Of Pages in SQL Server
1. Data pages - contain the actual data stored in the database.
2. Index pages - contain index data used to speed up query processing.
3. Allocation pages - keep track of the pages allocated to different database objects.
4. Global Allocation Map (GAM) pages - keep track of the free and used extents in a database.
5. Shared Global Allocation Map (SGAM) pages - keep track of mixed extents in a database.
6. Bulk Changed Map (BCM) pages - keep track of pages that have been modified by bulk operations, such as a large insert or update.
7. Differential Changed Map (DCM) pages - keep track of pages that have been modified since the last full backup
βββββββββ
π° @gopher_academy
1. Data pages - contain the actual data stored in the database.
2. Index pages - contain index data used to speed up query processing.
3. Allocation pages - keep track of the pages allocated to different database objects.
4. Global Allocation Map (GAM) pages - keep track of the free and used extents in a database.
5. Shared Global Allocation Map (SGAM) pages - keep track of mixed extents in a database.
6. Bulk Changed Map (BCM) pages - keep track of pages that have been modified by bulk operations, such as a large insert or update.
7. Differential Changed Map (DCM) pages - keep track of pages that have been modified since the last full backup
βββββββββ
π° @gopher_academy
π₯2π1π1
Check out this job at Canonical: https://www.linkedin.com/jobs/view/3441080629
βββββββββ
π° @gopher_academy
βββββββββ
π° @gopher_academy
π3π₯1π³1π1
βGo Proverbs
Don't communicate by sharing memory, share memory by communicating.
Concurrency is not parallelism.
Channels orchestrate; mutexes serialize.
The bigger the interface, the weaker the abstraction.
Make the zero value useful.
interface{} says nothing.
Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.
A little copying is better than a little dependency.
Syscall must always be guarded with build tags.
Cgo must always be guarded with build tags.
Cgo is not Go.
With the unsafe package there are no guarantees.
Clear is better than clever.
Reflection is never clear.
Errors are values.
Don't just check errors, handle them gracefully.
Design the architecture, name the components, document the details.
Documentation is for users.
Don't panic.
βββββββββ
π° @gopher_academy
Don't communicate by sharing memory, share memory by communicating.
Concurrency is not parallelism.
Channels orchestrate; mutexes serialize.
The bigger the interface, the weaker the abstraction.
Make the zero value useful.
interface{} says nothing.
Gofmt's style is no one's favorite, yet gofmt is everyone's favorite.
A little copying is better than a little dependency.
Syscall must always be guarded with build tags.
Cgo must always be guarded with build tags.
Cgo is not Go.
With the unsafe package there are no guarantees.
Clear is better than clever.
Reflection is never clear.
Errors are values.
Don't just check errors, handle them gracefully.
Design the architecture, name the components, document the details.
Documentation is for users.
Don't panic.
βββββββββ
π° @gopher_academy
π6π₯1
Ϊ©ΨͺΨ§Ψ¨ Ψ±Ψ§ΫΪ―Ψ§Ω Ψ’ΩΩΨ§ΫΩ Ψ¨Ψ±Ψ§Ϋ ΫΨ§Ψ―Ϊ―ΫΨ±Ϋ ΩΪ©Ψ§Ψͺ Ψ¨Ψ±ΩΨ§Ω
Ω ΩΩΫΨ³Ϋ Ψ³ΫΨ³ΨͺΩ
Ϋ
github.com/angrave/SystemProgramming/wiki
βββββββββ
π° @gopher_academy
github.com/angrave/SystemProgramming/wiki
βββββββββ
π° @gopher_academy
GitHub
Home
Angrave's Crowd-Sourced System Programming Book used at UIUC - angrave/SystemProgramming
β€4π1
βGoβs map hashes strings with CPU AES instructions
π‘ https://github.com/golang/go/blob/master/src/runtime/asm_amd64.s#L955
γ½οΈ if your processor has them, which it probably does.
cat /proc/cpuinfo | egrep 'aes|sse2|sse4_1' will tell you.
βββββββββ
π° @gopher_academy
π‘ https://github.com/golang/go/blob/master/src/runtime/asm_amd64.s#L955
γ½οΈ if your processor has them, which it probably does.
cat /proc/cpuinfo | egrep 'aes|sse2|sse4_1' will tell you.
βββββββββ
π° @gopher_academy
π2
βGo: Slice search vs map lookup
https://darkcoding.net/software/go-slice-search-vs-map-lookup/
βββββββββ
π° @gopher_academy
https://darkcoding.net/software/go-slice-search-vs-map-lookup/
βββββββββ
π° @gopher_academy
π5
What is WAL? (Write-ahead log) β A deep dive
https://medium.com/@hnasr/what-is-wal-write-ahead-log-a-deep-dive-a2bc4dc91170
βββββββββ
π° @gopher_academy
https://medium.com/@hnasr/what-is-wal-write-ahead-log-a-deep-dive-a2bc4dc91170
βββββββββ
π° @gopher_academy
Medium
Why databases need Write-ahead log (WAL)βββA deep dive
Foundational principal of any durable database system
π2π³2
Algorithm you should know before system design interview
βββββββββ
π° @gopher_academy
βββββββββ
π° @gopher_academy
π5π₯2