<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Enes Koç on Medium]]></title>
        <description><![CDATA[Stories by Enes Koç on Medium]]></description>
        <link>https://medium.com/@eneskoc?source=rss-3b6549f687f2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vjTnxINsJVLSiVtEwfiEkQ.jpeg</url>
            <title>Stories by Enes Koç on Medium</title>
            <link>https://medium.com/@eneskoc?source=rss-3b6549f687f2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 22:02:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eneskoc/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[DNS Resolution and the Use of “.”: A Performance Story]]></title>
            <link>https://medium.com/garantibbva-teknoloji/dns-resolution-and-the-use-of-a-performance-story-060747eba476?source=rss-3b6549f687f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/060747eba476</guid>
            <category><![CDATA[infrastructure]]></category>
            <category><![CDATA[fqdn]]></category>
            <category><![CDATA[haproxy]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[coredns]]></category>
            <dc:creator><![CDATA[Enes Koç]]></dc:creator>
            <pubDate>Thu, 20 Mar 2025 14:10:31 GMT</pubDate>
            <atom:updated>2025-03-20T14:10:31.505Z</atom:updated>
            <content:encoded><![CDATA[<p>In modern container-based applications, performance issues often stem from underlying infrastructure and network layers. In this article, we will discuss a DNS resolution-related performance issue we encountered in a Java application running on Garanti BBVA Openshift clusters, the root causes of the problem, and potential solutions. Specifically, we will explore the impact of using `”.”` (dot) in DNS queries and how platforms like OpenShift handle this scenario.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*L7xQynJQvsT1s3dS2cBfsQ.png" /></figure><p><strong>The Problem: Slowness and Java Stack Trace</strong></p><p>In one of our containerized applications, we noticed significant delays during certain user operations. Initially, we examined the application logs and performance metrics, but a deeper analysis was required to pinpoint the root cause. Upon inspecting the Java application’s stack trace, we identified the following bottleneck:</p><p>Inet4AddressImpl.lookupAllHostAddr : Java DNS resolution</p><p>This indicated that the delays were occurring during Java’s DNS resolution process. We concluded that the issue was related to DNS resolution and began investigating the DNS configuration in detail.</p><p><strong>DNS Resolution and Fully Qualified Domain Names (FQDN)</strong></p><p>During DNS resolution, whether or not a domain name ends with a ”.” affects how it is processed:</p><p><strong>- Domains Ending with ”.”:<br></strong> — These are treated as **Fully Qualified Domain Names (FQDN)**.<br> — For example, `abc-dev.acme.com.tr.` is directly resolved as-is, without any additional searches.</p><p><strong>- Domains Without ”.”:<br></strong> — These are treated as **partial domain names**, and the DNS resolver appends search domains from the `search` field in `/etc/resolv.conf` to generate multiple queries.<br> — For example, `abc-dev.acme.com.tr` will be combined with search domains, resulting in multiple DNS queries.</p><p><strong>DNS Configuration in OpenShift</strong></p><p>In OpenShift, the DNS resolution process is governed by the `/etc/resolv.conf` file inside the application container. Consider the following example configuration:</p><blockquote>search acme-dev.svc.cluster.local svc.cluster.local cluster.local nodename.acme.com.tr acme.com.tr<br>nameserver 10.219.0.10<br>options ndots:5 single-request</blockquote><p>Key components:<br>- **`search` Field**: Specifies additional domains to append during DNS resolution.<br>- **`ndots:5`**: Indicates that a domain name must contain at least 5 dots (`.`) to be treated as an FQDN.</p><p><strong>**Example: Querying `abc-dev.acme.com.tr`**<br></strong>If a DNS query is made for `abc-dev.acme.com.tr`, the resolver will attempt the following combinations in order:<br>1. `abc-dev.acme.com.tr.authentication-prod.svc.cluster.local`<br>2. `abc-dev.acme.com.tr.svc.cluster.local`<br>3. `abc-dev.acme.com.tr.cluster.local`<br>4. `abc-dev.acme.nodename.acme.com.tr`<br>5. `abc-dev.acme.com.tr.acme.com.tr`<br>6. `abc-dev.acme.com.tr`</p><p>This process increases DNS resolution time. However, if the domain is specified as `abc-dev.acme.com.tr.`, it is treated as an FQDN, and only a single query is made.</p><p><strong>TLS Offloading and Certificate Issues</strong></p><p>To reduce DNS resolution overhead, we attempted to use the `”.”` notation (e.g., `abc-dev.acme.com.tr.`). While this improved DNS resolution, it introduced a new issue in the browser: **Default HAProxy Certificate**. Normally, specific certificate has been set in edge route object, So we expected to come with own certificate.</p><p><strong>**Root Cause**<br></strong>- In OpenShift, the route was configured with `edge` termination, meaning TLS offloading was handled by OpenShift’s HAProxy router.<br>- HAProxy treats `abc-dev.acme.com.tr` and `abc-dev.acme.com.tr.` as separate `Host` headers. Since no route was defined for the `”.”` version, HAProxy returned the default certificate.</p><p><strong>**Why Does NGINX Work Correctly?**<br></strong>If TLS termination were handled inside an NGINX container:<br>- NGINX treats `abc-dev.acme.com.tr` and `abc-dev.acme.com.tr.` as equivalent.<br>- As a result, the correct certificate would be returned.</p><h4><strong>Behavior of Browsers, Curl, and Java</strong></h4><p>Different clients handle `”.”` in domain names differently:</p><p><strong>**1. Browsers**<br></strong>- Browsers generally treat `”.”` as an FQDN and perform DNS queries accordingly.<br>- If no route is defined for the `”.”` version, HAProxy returns the default certificate.</p><p><strong>**2. Curl**<br></strong>- Curl respects the `”.”` and performs DNS queries directly as an FQDN.</p><p><strong>**3. Java**<br></strong>- Java treats ”.” as an FQDN and perform DNS queries accordingly like Browsers.</p><p><strong>Sample java code for testing:</strong></p><p>1-Create java file called Main.java</p><p>2-Compile Main.java</p><p>3-Run the Main.class file</p><pre>dimport java.net.URL;<br>import javax.net.ssl.*;<br><br>public class Main {<br>    public static void main(String[] args) {<br>        try {<br>            // SSL doğrulamasını devre dışı bırakmak için özel bir SSLContext oluşturuyoruz<br>            SSLContext sc = disableSSLVerification();<br><br>            // URL&#39;yi tanımlıyoruz<br>            URL url = new URL(&quot;https://abc-dev.acme.com.tr./user/login&quot;);<br><br>            // Özel SSLContext&#39;ten bir SSLSocketFactory oluşturuyoruz<br>            SSLSocketFactory sslSocketFactory = sc.getSocketFactory();<br>            try (SSLSocket sslSocket = (SSLSocket) sslSocketFactory.createSocket(url.getHost(), 443)) {<br>                // TLS el sıkışmasını başlatıyoruz<br>                sslSocket.startHandshake();<br><br>                // SSLSession nesnesini alıyoruz<br>                SSLSession sslSession = sslSocket.getSession();<br><br>                // SNI server name bilgisini yazdırıyoruz<br>                System.out.println(&quot;SNI Server Name: &quot; + sslSession.getPeerHost());<br>            }<br><br>        } catch (Exception e) {<br>            e.printStackTrace();<br>        }<br>    }<br><br>    private static SSLContext disableSSLVerification() throws Exception {<br>        TrustManager[] trustAllCerts = new TrustManager[]{<br>            new X509TrustManager() {<br>                public java.security.cert.X509Certificate[] getAcceptedIssuers() {<br>                    return null;<br>                }<br>                public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {}<br>                public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {}<br>            }<br>        };<br><br>        SSLContext sc = SSLContext.getInstance(&quot;TLS&quot;);<br>        sc.init(null, trustAllCerts, new java.security.SecureRandom());<br>        return sc;<br>    }<br>}</pre><pre>javac Main.java<br>java Main</pre><p>Output:</p><p>SNI Server Name: abc-dev.acme.com.tr.</p><p><strong>Solution Alternatives</strong></p><p><strong>**1. Using the Dot Notation**<br></strong>a. **Adding a Second Address to the Existing Route**:<br> — OpenShift does not allow this.</p><p>b. **Creating a New Route**:<br> — OpenShift does not allow routes with `”.”` in the `Host` field, as it does not conform to the expected format.</p><p>c. **Terminating TLS Inside the Container**:<br> — This ensures the correct certificate is returned but increases the complexity of managing TLS certificates within the application.</p><p><strong>**2. Avoiding the Dot Notation**<br></strong>a. **Adjusting TTL Values in Java**:<br> — Modify `networkaddress.cache.ttl` and `networkaddress.cache.negative.ttl` to optimize DNS resolution in Java.</p><p><strong>Conclusion</strong></p><p>DNS resolution and the use of `”.”` play a critical role in the performance and certificate management of modern container-based applications. To avoid such issues in platforms like OpenShift, careful planning of DNS configurations and TLS termination strategies is essential. Additionally, understanding how different clients handle DNS resolution can help address performance bottlenecks effectively.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=060747eba476" width="1" height="1" alt=""><hr><p><a href="https://medium.com/garantibbva-teknoloji/dns-resolution-and-the-use-of-a-performance-story-060747eba476">DNS Resolution and the Use of “.”: A Performance Story</a> was originally published in <a href="https://medium.com/garantibbva-teknoloji">Garanti BBVA Teknoloji</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>