> For the complete documentation index, see [llms.txt](https://docs.vngcloud.vn/vng-cloud-document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vngcloud.vn/vng-cloud-document/vdns/operating-model.md).

# Operating Model

Understanding how DNS works with each record type and routing policy is essential for optimizing the performance and reliability of web applications. Below is a detailed explanation:

### How DNS Works with Different Record Types

When a user enters a domain name (for example: [www.example.com](http://www.example.com)) into a browser, the DNS resolution process occurs as follows:

#### Recursive Request

The user’s computer sends a domain name resolution request to the recursive DNS server configured on the computer or router.

#### Iterative Queries

The recursive DNS server begins a series of iterative queries to different DNS servers to find the IP address associated with the domain name. This process usually starts with the root server, followed by the top-level domain (TLD) server for `.com`, and then the authoritative name server for `example.com`.

#### Authoritative Response

The authoritative name server contains the DNS records for the `example.com` domain and returns the appropriate record based on the request.

Below is how different record types affect this process:

#### A Record

An A record maps a domain name to an IPv4 address. Example:

```
www.example.com.    A     192.0.2.1
```

When the DNS server receives a request for `www.example.com`, it returns the IP address `192.0.2.1`.

#### CNAME Record

A CNAME record creates an alias for another domain name. Example:

```
blog.example.com.   CNAME www.example.com.
```

When the DNS server receives a request for `blog.example.com`, it detects the CNAME record and continues querying for `www.example.com`, then returns the IP address associated with `www.example.com`.

#### MX Record

An MX record specifies the mail server responsible for receiving emails for a domain. Example:

```
example.com.        MX    10 mail.example.com.
```

The number `10` is the priority value. Lower numbers indicate higher priority. When a mail server wants to send an email to `user@example.com`, it queries the MX record and connects to the highest-priority mail server.

#### SRV Record

An SRV record specifies the location of specific services. Example:

```
_sip._tcp.example.com. SRV 10 0 5060 sipserver.example.com.
```

This record indicates that the SIP service over TCP is provided by the server `sipserver.example.com` on port `5060`.

#### PTR Record

A PTR record performs reverse DNS lookup, mapping an IP address back to a domain name. Example:

```
1.0.2.192.in-addr.arpa. PTR www.example.com.
```

When the DNS server receives a request for the IP address `192.0.2.1`, it returns the domain name `www.example.com`.

#### TXT Record

A TXT record contains arbitrary text. It is commonly used for purposes such as email authentication (SPF, DKIM, DMARC) or domain ownership verification.

```
example.com.        TXT   "v=spf1 mx -all"
```

### How DNS Works with Different Routing Policies

Routing policies determine how the DNS server selects which record to return when multiple records are available for the same domain name.

#### Simple Routing

This is the simplest routing policy. The DNS server returns records in the order they are listed. It is commonly used when there is only one server or when advanced routing features are unnecessary.

#### Geolocation Routing

This policy routes traffic based on the user’s geographic location. For example, users in Northern Vietnam may be routed to a server in Hanoi, while users in Southern Vietnam may be routed to a server in Ho Chi Minh City. This helps reduce latency and improve performance.

#### Weighted Routing (with Sticky Session)

This policy distributes traffic based on weights assigned to each resource (such as servers). For example, you can assign a weight of 70 to Server A and 30 to Server B, meaning that 70% of traffic will be routed to Server A and 30% to Server B.

The Sticky Session feature ensures that a specific user is consistently routed to the same server throughout their session. This is especially useful for applications that require session persistence, such as online shopping carts.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.vngcloud.vn/vng-cloud-document/vdns/operating-model.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
