Serverless Database Techniques <16 M>
(UNIT - 1)
1.Architectural Components of Serverless Database.
Serverless architecture is a software design approach that lets developers
build applications without managing the underlying infrastructure. In
serverless architecture, the cloud provider manages the servers, so
developers can focus on writing code.
1. Function as a service (FaaS)
FaaS is the foundational building block of serverless, responsible for executing the logic
that determines how resources are allocated in a given scenario. Depending on the
cloud environment in use, you can select a purpose-built FaaS offering like AWS
Lambda for Amazon Web Services (AWS), Microsoft Azure Functions for Azure, Google
Cloud Functions for the Google Cloud Platform (GCP).
2. The client interface
The client interface plays a major role in serverless functionality. You cannot force-fit
serverless architecture into any application you choose. The interface must be able to
support short spurts of requests, stateless interactions, and flexible integrations. The
interface must also be designed to be compatible with extremely high volume or low
volume data transfers.
3. A web server on the cloud
The web server is where a stateless interaction will be initiated after the user initiates it
and before the FaaS service terminates it. The web server is distinct from the backend
database, where the information delivered to users is stored. For example, suppose you
are an online video content provider. In that case, the web server is where user
requests, scripts, FaaS response, etc., are hosted before it is terminated as per the
ephemeral nature of serverless. On the other hand, the video content will be kept in
backend storage, waiting to be fetched as per user requests.
4. A security service
Security is a key element of serverless operations because:
The application handles thousands of concurrent requests. Each request has to be
authenticated before sending a response.
Due to its stateless nature, past interaction history isn’t stored. The application cannot
fall back on previous interactions to validate future ones.
The serverless model makes transparency and monitoring more difficult. You have to
obtain security intelligence from millions of events that are logged every day.
The distributed nature of serverless architecture means that there are multiple services
and vendors involved. The full landscape has to be secured.
Typically, serverless applications use a token service, where temporary credentials are
generated for users and can be used to invoke the function. You can also integrate
serverless-ready identity and access management services into your application. For
example, AWS Cognito works with AWS Lambda to authenticate user identity through
SSO or social networks. You may find similar services for the cloud vendor of your
choice.
5. Backend database
The backend database is where the information to be shared with the user is stored.
This could range from static content repositories to SQL databases, from media storage
to live broadcasting modes. Typically developers use backend as a service (BaaS)
solutions to further cut down maintenance and admin efforts. Also, most cloud vendors
provide BaaS solutions compatible with their FaaS offering.
6. API gateway
The API gateway connects components 1 and 2 – i.e., FaaS and the client interface.
When the user initiates an action, it is relayed across the API gateway to trigger an
event via the FaaS service. The gateway can connect the client interface to multiple
FaaS services and increase the application’s functional features.
2.Explain the Components of serverless computing and its benefits
provide Example based on the real world.
Serverless Computing
A cloud computing execution model known as serverless computing allows the cloud
provider to dynamically control server provisioning and allocation. Developers are
unaware of the complexity of operating these servers, which includes capacity planning,
scaling, and server maintenance. The cloud provider automatically executes the code in
stateless compute containers that are event-triggered, and fully managed by the
provider.
Serverless Computing Providers and Platforms
With distinct platforms and features suited to various development requirements,
serverless computing has emerged as a key area of attention for numerous cloud
service providers. These are a few of the top platforms and providers of serverless
computing:
● AWS Lambda: Without having to provision or manage servers,
developers may use AWS Lambda, perhaps the most well-known
serverless computing tool, to execute code in response to events from
more than 200 AWS services and SaaS apps.
● Azure Functions: With Azure Functions, a serverless compute solution
from Microsoft, you can execute event-triggered code without explicitly
provisioning or managing infrastructure. Azure Functions easily
connects with other Azure services and supports a large number of
programming languages.
● Google Cloud Functions: This is the serverless execution
environment used by Google to create and link cloud services. All you
have to do with Google Cloud Functions is write your code; Google
handles the management, scaling, and underlying infrastructure.
● Oracle Cloud Functions: Using functions that are triggered by HTTP
requests or events coming from Oracle Cloud services, developers can
create apps with Oracle's serverless architecture. It is intended to
provide an integrated cloud experience by integrating easily with
Oracle's existing cloud products.
A real-world example of serverless database computing is an online food
ordering system for a small restaurant using Firebase Firestore.
When a customer places an order through the website or app, the order details are
directly stored in Firestore, eliminating the need for a traditional database server. The
restaurant staff can see new orders in real time without refreshing, thanks to Firestore’s
automatic updates. Since it's serverless, the database scales automatically based on
demand, and the restaurant only pays for the actual reads and writes, reducing costs.
This makes it an efficient and cost-effective solution for small businesses that don’t want
to manage database infrastructure.
UNIT - 2
1.CRUD Operations
The full form of CRUD is Create, Read, Update, and Delete. These four basic functions
represent the essential types of operations that can be performed on data stored within
a database. By mastering CRUD operations, developers can effectively manage and
manipulate the data in databases, making CRUD a foundational concept in software
development.
CREATE
This operation is used to add new data to the database. For example, an e-commerce
company might use the create operation to add a new product to its catalog.
CREATE TABLE products (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(255) NOT NULL,
price DECIMAL(10, 2) NOT NULL,
description VARCHAR(255) NOT NULL
);
INSERT INTO products (name, price, description)
VALUES ("Smartphone," 499.99, "Latest technology smartphone with high-end
features");
READ
The operation is used to retrieve data from the database. For example, a customer
might use the read operation to retrieve information about a product before buying.
SELECT * FROM products WHERE id = 1;
UPDATE
With this operation, you can change the data already in the database. For example, a
company could change the price of a product in its catalog by using the update
operation.
UPDATE products SET price = 479.99 WHERE id = 1;
DELETE
This is how you get rid of information from the database. For example, a company could
use the delete operation to eliminate a product that has been taken off the market.
DELETE FROM products WHERE name = 'Smartphone';
*to learn more click here
Benefits of CRUD Operations
Data Management at Lightning Speed
Organizations can manage their data like never before with the help of CRUD
operations. With the ability to create, read, update, and delete data instantly, they can
always keep it organized and up-to-date. Say goodbye to duplicates and hello to data
management that moves at the speed of light.
Boosted Productivity
CRUD operations help organizations to increase their productivity. No more manual
data entry and no more room for human error. Organizations with consistent data at
their fingertips can make better business decisions and move their business forward.
Scalable Solutions
As the organization grows, so do the CRUD operations. These operations are made to
handle a lot of data, which makes it easy to scale up and meet the needs of a growing
business.
User-Friendly Experience
With CRUD operations, organizations can eliminate data management processes that
are hard to understand. They have an easy-to-use interface that allows team members
to get to and manage the information they need.
Unwavering Data Security
With CRUD operations, organizations can ensure that their sensitive data is safe.
Controls are put in place so that only authorized users can add, read, change, or delete
information. This protects and keeps private information secure.
Smooth Collaboration
Collaboration is seamless with CRUD operations, as many users can access and
modify data together. This improves teamwork and the speed of project completion.
Streamlined Workflow
CRUD operations are based on being as efficient as possible. These simplify data
management tasks by automating them and reducing the time and money needed for
data management. This makes the organization work better and makes it easier for
people to do their jobs.
Simplified Data Backup and Recovery
With CRUD operations, organizations can easily find, change, and delete data, which
makes it easier to back up and recover data. This ensures that the organization's data is
backed up regularly and can be quickly restored in case of a disaster or data loss. This
keeps the organization's data safe and secure
2.Features and Advantages of sqlite in detail
SQLite is a highly efficient, serverless, and self-contained SQL database
engine that stands out for its simplicity and ease of integration. Designed to
be embedded within applications, SQLite eliminates the need for separate
database server processes and complex configurations.
Features of SQLite
1. The transactions follow ACID properties i.e. atomicity, consistency,
isolation, and durability even after system crashes and power failures.
2. The configuration process is very easy, no setup or administration is
needed.
3. All the features of SQL are implemented in it with some additional
features like partial indexes, indexes on expressions, JSON, and
common table expressions.
4. Sometimes it is faster than the direct file system I/O.
5. It supports terabyte-sized databases and gigabyte-sized strings and
blobs.
6. Almost all OS supports SQLite like Android, BSD, iOS, Linux, Mac,
Solaris, VxWorks, and Windows (Win32, WinCE, etc. It is very much
easy to port to other systems.
7. A complete database can be stored in a single cross-platform disk file.
Advantages of SQLite Database
1.Easy to Use:
One of the biggest advantages of SQLite is its ease of use. It is a self-contained
database that does not require any server setup or configuration. Developers can
simply include the SQLite library in their applications and start using it right away.
SQLite uses a simple SQL syntax that is easy to understand and implement. It supports
most of the SQL92 standard, which makes it compatible with most database tools and
applications.
2.Lightweight and Fast:
SQLite is a lightweight database engine that has a very small memory footprint. It uses
a single file to store data, which makes it highly efficient and fast. SQLite can handle
small to medium-sized databases with ease and can perform well even on low-end
hardware.
3.Cross-Platform Compatibility:
Another advantage of SQLite is its cross-platform compatibility. SQLite works on various
platforms, including Windows, Mac, Linux, iOS, Android, and more. This makes it a
popular choice for developers who need to develop applications for multiple platforms.
4.Zero-Configuration:
SQLite is a zero-configuration database engine, which means that it does not require
any setup or configuration. Developers can simply include the SQLite library in their
applications and start using it right away. This makes it easier to deploy and maintain,
as well as more reliable and stable.
5.Transactional Support:
SQLite supports transactions, which ensures the consistency and integrity of the data.
Transactions in SQLite follow the ACID properties and can be used to group multiple
SQL statements into a single transaction. This makes it easier to manage data aLow
Memory Footprint
6.Good for Small to Medium-Sized
Databases: SQLite is designed to handle small to medium-sized databases with ease. It
is not suitable for large datasets that require high concurrency or scalability. However, it
can handle most of the data needs for mobile applications, web browsers, and
embedded devices.
7.Free and Open Source:
SQLite is free and open-source software, which means that it can be used for any
purpose without any licensing fees. It is also regularly updated and maintained by a
community of developers, which ensures that it stays relevant and up-to-date.