<?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 Ashish Singh on Medium]]></title>
        <description><![CDATA[Stories by Ashish Singh on Medium]]></description>
        <link>https://medium.com/@shashan0007?source=rss-279e751e51a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*8PNI3ZxuU2KO61xb</url>
            <title>Stories by Ashish Singh on Medium</title>
            <link>https://medium.com/@shashan0007?source=rss-279e751e51a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 16:37:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shashan0007/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[Run intellij in WSL 2 and build project in Ubuntu WSL]]></title>
            <link>https://medium.com/@shashan0007/run-intellij-in-wsl-2-and-build-project-in-ubuntu-wsl-3cb6310e7c3b?source=rss-279e751e51a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cb6310e7c3b</guid>
            <category><![CDATA[wsl-2]]></category>
            <category><![CDATA[intellij-idea]]></category>
            <dc:creator><![CDATA[Ashish Singh]]></dc:creator>
            <pubDate>Fri, 16 Dec 2022 13:59:28 GMT</pubDate>
            <atom:updated>2022-12-17T05:04:07.976Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bf8zCh8s1kLQVjbJs6Mw6A.png" /><figcaption>Credits: <a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fitnext.io%2Fusing-wsl-2-to-develop-java-application-on-windows-8aac1123c59b&amp;psig=AOvVaw27n0qCHuxn9i-zTr7FvUDt&amp;ust=1671285445275000&amp;source=images&amp;cd=vfe&amp;ved=0CBIQ3YkBahcKEwiI3pzMpf77AhUAAAAAHQAAAAAQBA">https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fitnext.io%2Fusing-wsl-2-to-develop-java-application-on-windows-8aac1123c59b&amp;psig=AOvVaw27n0qCHuxn9i-zTr7FvUDt&amp;ust=1671285445275000&amp;source=images&amp;cd=vfe&amp;ved=0CBIQ3YkBahcKEwiI3pzMpf77AhUAAAAAHQAAAAAQBA</a></figcaption></figure><p>Install Intellij Idea in WSL. Open a maven, gradle or any other type of project in WSL. Finally, build it.</p><p>For most of the projects today, the deployment is needed to be done on the cloud systems which are typically *nix systems. There can be some *nix OS dependent dependencies in the project which, if the local build is compiled on Windows system, will not compile.</p><p>To build that, an instance of *nix system is needed which can be a physical *nix machine, a *nix VM(on bare metal or on cloud).</p><p>As developers, we often do not and should not worry about the infrastructure. But, given the separation-of-concerns within different teams in an organization, the above mostly lies on the shoulders of Devops team, who need to be requested for any further updates to the instance.</p><p>This can be avoided. How?</p><p>WSL2 (Windows Subsystem for Linux) comes to the rescue here.</p><p><strong>What is WSL2 (Windows Subsystem for Linux)</strong></p><p>WSL2 can be considered as an instance of *nix present on a windows machine. One powerful feature that comes along-with having WSL is that the Windows file system is mounted on the WSL and vice-versa. In other words, WSL2 shares the Windows file system. This way, any binary, any path that is present can be referred within the WSL. Ex: If we have set M2_HOME on the windows machine within C:/Users/&lt;user&gt;/.m2, the same M2_HOME can be set within the WSL as:</p><blockquote>export M2_HOME=/mnt/c/Users/&lt;user&gt;.m2</blockquote><p>And that is it. We have the maven present in WSL.</p><p>Another powerful feature that WSL brings is that after the Docker Desktop was made commercial, many organizations prohibited their users from using Docker desktops. Mind here, that only the Docker Desktop is made commercial and not the underlying Docker itself. So, Docker can still be setup on WSL and is 100% free. Apart from this, local kinD, minikube clusters can also be setup within WSL for testing purposes.</p><p>That is a lot of power, right?</p><p>I recommend every developer to have WSL installed on their Windows machine. To do that, follow the below article:</p><p><a href="https://dev.to/bowmanjd/install-docker-on-windows-wsl-without-docker-desktop-34m9">https://dev.to/bowmanjd/install-docker-on-windows-wsl-without-docker-desktop-34m9</a></p><p><strong>Setting up git in WSL</strong></p><p>Once WSL is setup, install git on WSL or refer git binary from the mount windows file system, as explained above.</p><p>To install within WSL (Ubuntu)</p><blockquote>sudo apt update</blockquote><blockquote>sudo apt-get install git</blockquote><blockquote>git config — global user.name “FIRST_NAME LAST_NAME”</blockquote><blockquote>git config — global user.email “MY_NAME@example.com”</blockquote><p>After the git is installed. We can run all git commands like git clone, git fetch, git pull, etc.</p><p>Clone the project within WSL.</p><p><strong>Set up SSH service within WSL</strong></p><p>To setup ssh within WSL, run commands:</p><p>Check if ssh is enabled:</p><blockquote>sudo service ssh status</blockquote><p>If it is not running, run it as:</p><blockquote>sudo service ssh start</blockquote><p>If SSH service is not present, install it as:</p><blockquote>sudo apt update &amp;&amp; sudo apt install openssh-server</blockquote><p>Check the IP of the WSL with ifconfig. This IP can now be used for SSH login from Windows machine or any application (like WinSCP) within the network. You can also generate RSA private-public keys on windows and copy public key within ~/.ssh/authorized_keys on your WSL. If ~/.ssh/authorized_keys does not exist. Create it and then copy the contents of your public key in ~/.ssh/authorized_keys file. This way, you can login to WSL instance via SSH using your private-public keys.</p><p><strong>Install intelliJ Idea in WSL</strong></p><p>Download the linux distribution(.tar.gz) of intellij idea or from WSL, run curl with below link:<br><a href="https://www.jetbrains.com/idea/download/download-thanks.html?platform=linux&amp;code=IIC">https://www.jetbrains.com/idea/download/download-thanks.html?platform=linux&amp;code=IIC</a></p><p>If downloaded in Windows, copy it over to WSL. Untar with tar-xvzf.</p><p>Create a symbolic link to idea.sh within the untar intellij package.</p><p>From home directory:</p><blockquote><strong>ln -s idea /path/to/intelli-on-wsl/bin/idea.sh</strong></blockquote><p>This creates a symbolic link in WSL home directory.</p><p>Open the project with Intellij Idea to start working as:</p><p>From home directory:</p><blockquote>./idea &lt;path-to-project-to-be-opened-as-idea-project&gt;</blockquote><p><strong>Voila,</strong> the project is now opened for working in WSL.</p><p><strong>Configure Maven in intellij for m2 repository and settings xml</strong></p><blockquote>Open <strong>File-&gt;Settings-&gt;Build,Execution,Deployment-&gt;Maven</strong></blockquote><p>Configure Maven Home Path, User settings file, Local repository by referring to the ones on the Windows mount path mounted something as /mnt/c/&lt;path_in_C_drive_on_Windows&gt;</p><p>Now, your pom direct and transitive dependencies will start to be fetched from the artifactory or the project will sync itself if they are already present in the local maven repository you specified above.</p><p><strong>Network issues<br></strong>The above attached article(setting up docker on wsl) will let you help with the network issue if you are not able to reach the internet from your wsl instance.</p><p>If you are still unable to reach the internet, just make sure that /etc/resolv.conf has the right IPs as per your network. Then, you will be able to access the internet.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cb6310e7c3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running Minio as a pod in Kubernetes]]></title>
            <link>https://medium.com/@shashan0007/running-minio-as-a-pod-in-kubernetes-746fbf1c4b24?source=rss-279e751e51a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/746fbf1c4b24</guid>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[k8s]]></category>
            <category><![CDATA[minio]]></category>
            <dc:creator><![CDATA[Ashish Singh]]></dc:creator>
            <pubDate>Mon, 16 May 2022 09:36:08 GMT</pubDate>
            <atom:updated>2022-05-16T09:40:43.231Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*ZjMf2z8Paa589RKslLUmtw.png" /></figure><p>In the recent technology world, a lot of the services are moving to the cloud which provide a number of benefits. One such benefit is to leverage the ‘cold’ cloud storage like AWS S3, Azure Storage, etc. to store data on the cloud to archive it and make it consistent.<br>AWS is the most widely used cloud provider. And, its storage service, AWS S3 is also widely preferred. <strong>BUT. </strong>Storing objects in AWS S3 comes at a cost. Infact, the services provided by AWS are chargeable if you are not using the free-tier. In many scenarios, we do not have an AWS account with us but are needed to test the archival of our data to S3. Minio comes to the rescue here.</p><p><strong>What is minio?</strong></p><p>MinIO is a High Performance Object Storage. It is API compatible with Amazon S3 cloud storage service. API compatible means — all the API calls to an AWS S3 can also be sent to a minio deployment i.e. we can replace AWS S3 with minio (do it for dev related purposes).</p><p>Installing minio on your OS is an easy task and can be done by following official page for minio.</p><p><a href="https://docs.min.io/docs/minio-quickstart-guide.html">https://docs.min.io/docs/minio-quickstart-guide.html</a></p><p>But, in this article, we are going to see how we can set up minio as a pod in kubernetes.</p><p>I shall be providing the various files below along-with the environment and installation scripts. The files can be put in a directory on your linux machine and then deployed.</p><p><strong>Pre-requisites:</strong></p><ol><li>A k8s cluster must be available on which the minio pod is to be run.</li><li>The Node should be able to access the Docker and helm registries.</li></ol><p><strong>Steps:</strong></p><p>Please clone the below repository into your local:<br><a href="https://github.com/AshishKmrSingh/cloud/tree/master/minio-on-k8s">https://github.com/AshishKmrSingh/cloud/tree/master/minio-on-k8s</a></p><p>The below steps need to be followed:<br>1) Make changes to env script as per your environment and need.</p><p>2) Source env script.</p><p>3) Run installation script. It will install minio pod on your k8s cluster. Basically, it will create K8s service, deployment, pv and pvc.</p><p>4) To uninstall the minio pod, run the uninstallation script. It will delete the namespace as well as the pv.</p><p><strong>Notes:</strong></p><ol><li>The pod will have its service as a NodePort type. It can be changed to ClusterIP or load-balancer as well depending on your requirement.<br>With NodePort, you can very quickly set it up and can access minio UI using the K8s Node IP and the port allotted to the service.</li></ol><blockquote>To check the port allotted to the service, run the command:<br>kubectl get svc -n &lt;namespace&gt;</blockquote><p>The output will be something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*uqh6raVeu3G7nwHHrhRlrg.png" /></figure><blockquote>So, you can access the UI at &lt;Node_IP&gt;:31929</blockquote><p>2. The minio deloyed is deployed with the access key and secret keys as <strong>minio</strong> and <strong>minio123. </strong>These can be customized either from the environment properties or can be replaced in <strong>minio-deployment.yml</strong> file.</p><p>3. minio-pv and minio-pvc are the persistent volume and associated persistent volume claims respectively.</p><p>That is all Folks. Happy coding.</p><p>Please let me know for any queries or any cloud related article you want me to publish.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=746fbf1c4b24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An easy explanation of Java Memory Model]]></title>
            <link>https://medium.com/@shashan0007/an-easy-explanation-of-java-memory-model-baa3b4f0fdec?source=rss-279e751e51a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/baa3b4f0fdec</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[jvm]]></category>
            <category><![CDATA[java-memory-model]]></category>
            <dc:creator><![CDATA[Ashish Singh]]></dc:creator>
            <pubDate>Thu, 28 Oct 2021 13:30:34 GMT</pubDate>
            <atom:updated>2021-10-28T13:30:34.928Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*elu2m2WZIWEJWOl_YqOVDQ.png" /></figure><p>First things first — Why is it being called Java Memory Model?</p><p>The Java application runs inside a JVM (Java Virtual Machine) . This JVM is a computer in itself. Some of the processes like Garbage Collection run in it.</p><p>What is memory and does JVM has a memory of its own?</p><p>We have studied, computers have CPU and memory (external or internal). CPU has some memory of its own — registers and CPU cache. The registers are closer to the CPU, so working with them is faster. Remember, all the processing is done in the CPU itself. The another level of memory which is called CPU cache is larger than register memory but slower than it.</p><p>So, the rule states farther the memory from the CPU, slower is the processing. Why? Because the data is brought from any memory to the CPU cache, processed and then changes are written to it. The CPU cache is divided into blocks itself. So, any read/write to/from RAM is in blocks. So, CPU cache is concurrent.</p><p>Further, multi-core CPU can run multiple applications or threads simultaneously. In a 2-core CPU system, 2 threads can run simultaneously and so on. Until these are different applications not using a shared resource, it is fine but when the resource is being shared, proper utilization and assuring the universal change visibility to that resource becomes the key. Lets take an example -</p><p>If a thread writes to a memory in CPU cache and another thread reads from RAM. So, we can not justify that second thread got the same value for that resource from the RAM which is available after update inside CPU cache. It is highly possible that that particular cache block was not written to the RAM by the JVM before another thread had read the value of that resource from RAM.</p><p>This is why we need to deal with concurrency.</p><p>JVM uses the memory from our underlying architecture. Physically it has no separate memory but the term JVM memory means the memory being used by JVM from the underlying memory architecture.</p><p>JVM memory model means how is the memory allocated to JVM being used internally by it?</p><p>It allocates it in 2 ways — Stack space and heap space. Both are on the same underlying memory but the way they are used is different.</p><p>Stacks contain the method copies of individual threads with local variables in it. So, if 2 threads call the same method, then they will have 2 different stacks with different copies of local variables inside that method. Sequential method calls are put in this stack on top of another.</p><p>Heap space is the area where all the objects are allocated. It does not matter whether the object is created inside a thread’s local method or is a member variable of an object or is a referenced object. It is allocated on the heap space. Static member variables are also allocated on the heap space.</p><p>We can easily say that it is necessary to allocate memory efficiently. That is why we assign some parameters like Xmx (Max heap size), Xms (Initial Heap Size) to make sure that the applications’ performance in terms of memory is efficient and we do not get Out Of Memory Errors. If we get OOMs, we can be pretty sure that either our heap size needs to be increased or there is some memory leak in our application. In the latter case, analyzing a heap dump for unusually large size objects can provide clue where the memory might be leaking.</p><p>The above explanation highlights how the JVM uses memory from the underlying architecture and how it uses it, why is it needed to use it this way, what are the problems in multi-core systems?</p><p>I hope to provide some easy explanation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baa3b4f0fdec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>