(DSY) Tutorial 01
(DSY) Tutorial 01
Activity 1:
1.1:
* Hardware:
- Central Processing Unit: trong môi trường cloud computing, virtual machines
chia sẻ các tính năng để sử dụng, sẽ gặp trường hợp chạy trên máy khác nhau
nhưng cùng một phần cứng.
- RAM: nhiều virtual machines chia sẻ các bộ nhớ vật lý của máy chủ thông qua
các bộ ảo hóa quản lý việc phân bổ và cách ly RAM giữa các máy ảo.
- Storage Devices: các thiết bị trong cùng hệ thống phân tán có thể truy cập và chia
sẻ ở cùng một kho lưu trữ dữ liệu.
- Input/Output Devices (e.g., Printers, Scanners): Trong môi trường văn phòng,
nhiều máy tính có thể kết nối với một máy in/ scanner thông qua a print server, cho
phép nhiều máy có thể in cùng một thiết bị in.
-Shared wifi network: The wireless router shares the internet connection among all
connected devices, allowing everyone to access online resources simultaneously
through the same hardware infrastructure.
* Data or Software:
- Databases: A distributed database like Apache Cassandra allows multiple
applications and users to access and modify the same dataset across a cluster of
servers, ensuring high availability and fault tolerance.
- Ecosystem models: Like Google Workspace allow multiple users to share and
colllaborate on applications like Docs, Sheets, etc. In real time, with all data stored
in the cloud.
- File systems: Like Google Drive allows user can access shared files and
directories over a network, enabling users to work with the same set of files from
different locations.
- Shared libraries: Shared libraries or dynamic link libraries (DLLs) can be used by
multiple programs. Like in programming, we can use many available libraries to
utilize for coding.
- Version Control Systems: Example: Git repositories hosted on platforms like
GitHub allow multiple developers to share and collaborate on codebases. Each
developer can work on their own branch while sharing a common history,
facilitating version control and collaborative development across teams.
1.2:
They can share their built-in GPS to detect the user’s location automatically. If
GPS is unavailable or inaccurate indoors, the device could connect to nearby Wi-Fi
networks or use cell tower triangulation to determine the location.
There are some technical challenges they can be taken such as GPS sẽ gặp vấn đề
về kết nối mạng, mất sóng; or users might need control over what information is
shared, etc.
1.3:
- Client-Side Component
Example of Failure: In a web browser, the JavaScript code responsible for sending
an API request to a server encounters an unexpected exception (e.g., a function is
called on a null object), causing the client-side script to crash.
Tolerance Strategy:
Graceful Error Handling: Implement try-catch blocks to handle exceptions
gracefully and provide a fallback mechanism, such as displaying a user-friendly
error message and logging the error for future debugging.
Retries with Backoff: If the request fails due to a transient issue (like a temporary
network glitch), the client can automatically retry the operation after a brief delay.
- Network Communication
Example of Failure: In a microservices architecture, a service fails to communicate
with another service due to a temporary network partition, resulting in a timeout.
Tolerance Strategy:
Circuit Breaker Pattern: Implement a circuit breaker to detect repeated failures in
communication. Once the circuit breaker is "tripped," it prevents further attempts
to communicate with the failing service, allowing the system to degrade gracefully
and recover once the network issue is resolved.
Service Discovery and Load Balancing: Use a service discovery mechanism
combined with load balancing to automatically reroute requests to healthy
instances of the service if one becomes unreachable.
- Server-Side Component
Example of Failure: A database server crashes while processing a complex query,
resulting in the loss of the client's query result.
Tolerance Strategy:
Replication and Failover: Use database replication where multiple copies of the
database are maintained on different servers. If the primary database server fails, a
replica can take over as the primary, ensuring continued availability of the data.
Transaction Logging and Recovery: Implement transaction logs that record every
change made by the database. In the event of a crash, the server can recover to a
consistent state by replaying the logs.
1.4:
URL stands for Uniform Resource Locator which is a reference to a resource on
the internet.
- Web Pages: https://www.example.com/index.html
This url points to an HTML web page that can be accessed and viewed in a
web browser.
- Images: https://www.example.com/images/photo.jpg
This url points to an image file, in this case is a JPEG image that can be
displayed on a web page or download.
- APIs: https://api.example.com/v1/users/123
This url points to a specific endpoint of a web service API, which ,might
return data about a user in JSON format when accessed.
1.5:
For example, I have a link: http://www.example.com:8080/path/to/resource.html?
query=123#section2
Main Components of an HTTP URL:
Scheme: “http”, this scheme indicates the protocol used to access the resource. In
this case, http specifies that the Hypertext Transfer Protocol is used.
Boundary: It is separated from the rest of the URL by ://.
Host: www.example.com, the host specifies the domain name or IP address of the
server where the resource is located.
Boundary: It comes immediately after :// and ends before the port (if specified) or
the next /.
Port: “8080”, the port number indicates the specific port on the host server to
which the request should be sent. If not specified, the default port for HTTP is 80.
Boundary: It is denoted by : after the host and before the path.
Query String: “?query=123”, the query string contains data to be sent to the server,
often used for search parameters or data submission. It's a set of key-value pairs.
Boundary: It starts with ? after the path and ends before the fragment #.