<?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 luke on Medium]]></title>
        <description><![CDATA[Stories by luke on Medium]]></description>
        <link>https://medium.com/@luke1337?source=rss-d4c14b0df2f1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by luke on Medium</title>
            <link>https://medium.com/@luke1337?source=rss-d4c14b0df2f1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 20:56:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@luke1337/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[NESA.ai — #1 — How to limit the miner’s RAM consumption]]></title>
            <link>https://medium.com/@luke1337/nesa-ai-1-how-to-limit-the-miners-ram-consumption-87f8069c68e3?source=rss-d4c14b0df2f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/87f8069c68e3</guid>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[nesa]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[airdrop]]></category>
            <dc:creator><![CDATA[luke]]></dc:creator>
            <pubDate>Sun, 06 Oct 2024 21:34:14 GMT</pubDate>
            <atom:updated>2024-10-13T20:26:24.819Z</atom:updated>
            <content:encoded><![CDATA[<h3>NESA.ai — #1 — How to limit the miner’s RAM consumption</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OKbqxYtYou-hx-Q3i4DIyw.png" /></figure><p>When it comes to running NESA efficiently, it’s crucial to allocate as many resources as possible to your miner. However, there are times when you may want to limit its RAM usage to prevent issues. The most RAM-demanding container in NESA is the <strong>‘orchestrator’</strong>. If you experience server crashes or other applications failing, it’s likely due to this container consuming all available RAM. When a job inference is sent from NESA to your miner, the RAM usage can spike dramatically, potentially leaving you with no memory left for other processes.</p><p>To mitigate this, you can limit how much RAM the ‘orchestrator’ container is allowed to use.</p><h3>How to Limit RAM Usage</h3><p><strong>1. Navigate to the Docker directory:</strong><br>First, connect to your server and locate the .nesa directory in your home folder, followed by the docker subdirectory:</p><pre>cd ~/.nesa/docker &amp;&amp; ls -als</pre><p><strong>2. Find the orchestrator Docker Compose file:</strong><br>Inside the docker directory, you’ll find various docker-compose files. The one we need is named compose.orchestrator.yml.<br>This is what you get to see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F7h02jevKzUF3xz8Pzt8ig.png" /></figure><p><strong>3. Edit the file:</strong><br>Open the file using your preferred text editor, such as nano, vim, or vi. In this case, we&#39;ll use nano:</p><pre>nano compose.orchestrator.yml</pre><p><strong>4. Locate the orchestrator section:</strong><br>The content of the file should look something like this:</p><pre>services:<br> ipfs:<br> extends:<br> file: compose.ipfs.yml<br> service: ipfs<br> mongodb:<br> image: mongodb/mongodb-community-server:6.0-ubi8<br> container_name: mongodb<br> restart: unless-stopped<br> environment:<br> - MONGODB_INITDB_ROOT_USERNAME=nesa_user<br> - MONGODB_INITDB_ROOT_PASSWORD=nesa_pass<br> ports:<br> - &#39;27017:27017&#39;<br> volumes:<br> - mongodata:/data/db<br> networks:<br> - nesa<br> healthcheck:<br> test: echo &#39;db.runCommand(&quot;ping&quot;).ok&#39; | mongosh localhost:27017/nesa - quiet<br> interval: 10s<br> timeout: 10s<br> retries: 5<br> start_period: 40s<br>orchestrator:<br> image: ghcr.io/nesaorg/orchestrator:testnet-latest<br> container_name: orchestrator<br> restart: unless-stopped<br> ports:<br> - &quot;31333:31333&quot;<br> depends_on:<br> mongodb:<br> condition: service_healthy<br> networks:<br> - nesa<br> env_file:<br> - ./env/base.env<br> - ./env/orchestrator.env<br> environment:<br> - MONGO_URI=mongodb://nesa_user:nesa_pass@mongodb:27017<br> volumes:<br> - ${HOME}/.nesa/cache:/root/.cache<br> - ./logs:/orchestrator/dist/logs<br> - ${HOME}/.nesa/identity:/identity<br>volumes:<br> mongodata:<br> ipfs-data:<br> ipfs-staging:<br>networks:<br> nesa:<br> driver: bridge</pre><p><strong>5. Add memory limits:</strong><br>To limit the RAM usage of the ‘orchestrator’ container to 12GB, modify the orchestrator service by adding resource limits under it, like this:</p><pre>services:<br>  ipfs:<br>    extends:<br>      file: compose.ipfs.yml<br>      service: ipfs<br>  mongodb:<br>    image: mongodb/mongodb-community-server:6.0-ubi8<br>    container_name: mongodb<br>    restart: unless-stopped<br>    environment:<br>      - MONGODB_INITDB_ROOT_USERNAME=nesa_user<br>      - MONGODB_INITDB_ROOT_PASSWORD=nesa_pass<br>    ports:<br>      - &#39;27017:27017&#39;<br>    volumes:<br>      - mongodata:/data/db<br>    networks:<br>      - nesa<br>    healthcheck:<br>      test: echo &#39;db.runCommand(&quot;ping&quot;).ok&#39; | mongosh localhost:27017/nesa --quiet<br>      interval: 10s<br>      timeout: 10s<br>      retries: 5<br>      start_period: 40s<br><br>  orchestrator:<br>    image: ghcr.io/nesaorg/orchestrator:testnet-latest<br>    container_name: orchestrator<br>    restart: unless-stopped<br>    ports:<br>      - &quot;31333:31333&quot;<br>    depends_on:<br>      mongodb:<br>        condition: service_healthy<br>    networks:<br>      - nesa<br>    env_file:<br>      - ./env/base.env<br>      - ./env/orchestrator.env<br>    environment:<br>      - MONGO_URI=mongodb://nesa_user:nesa_pass@mongodb:27017<br>    volumes:<br>      - ${HOME}/.nesa/cache:/root/.cache<br>      - ./logs:/orchestrator/dist/logs<br>      - ${HOME}/.nesa/identity:/identity<br>    deploy:<br>      resources:<br>        limits:<br>          memory: 12g<br>          cpus: &#39;5.0&#39;<br><br>volumes:<br>  mongodata:<br>  ipfs-data:<br>  ipfs-staging:<br><br>networks:<br>  nesa:<br>    driver: bridge</pre><p>Notice the part where we added resources &gt; limits &gt; memory &amp; cpu. The “memory” part limits RAM to 12GB, the “cpus” part limits the CPU to allocate maximum of 5 cores.</p><p><strong>6. Recreate the orchestrator container:</strong><br>After editing the file, you need to recreate the orchestrator container. It should be enough to run the bootstrapping bash script again via Advanced Wizardy:</p><pre>bash &lt;(curl -s https://raw.githubusercontent.com/nesaorg/bootstrap/master/bootstrap.sh)</pre><p>This will recreate the orchestrator container using the existing images without pulling them again.</p><p><strong>7. Verify the changes:</strong><br>Finally, check that the orchestrator container is running within the specified memory limits:</p><pre>docker stats orchestrator</pre><p>This will display real-time resource usage, allowing you to confirm that the orchestrator is staying within its 12GB memory limit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*S8KXj_RIBWiR6xqqKyVwVA@2x.png" /></figure><p>That’s all!</p><p>Let me know if you have any other helpful ideas for a post.</p><p>Feel free to drop a follow on Twitter, I will follow back: <a href="https://x.com/12_Bonzai">https://x.com/12_Bonzai</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87f8069c68e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>