GithubHelp home page GithubHelp logo

Comments (6)

fbacchella avatar fbacchella commented on August 16, 2024 1

Did you try with Epsilon: A No-Op Garbage Collector ?

from jeromq.

fbacchella avatar fbacchella commented on August 16, 2024 1

I ran you code, there is a few hiccups of about 100-200ms, but not a lot.
A long time ago, a similar question was asked and I do some investigation, that might give you some leads: #723 (comment)

from jeromq.

PanagiotisDrakatos avatar PanagiotisDrakatos commented on August 16, 2024

@fbacchella I have been using this
-XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC
but the problem still persists any other possible solutions?

Thanks in advance

from jeromq.

fbacchella avatar fbacchella commented on August 16, 2024

Context and sockets are created in the while loop, so every thing is new. I rather look at low level problems like socket exhaustion.

from jeromq.

PanagiotisDrakatos avatar PanagiotisDrakatos commented on August 16, 2024

@fbacchella i forgot to mention that those upsurges started after the fourth/third time not exactly after many reconnections to conclude and say that socket exhaustion is the problem. Are y sure about that? Any other clue?

from jeromq.

PanagiotisDrakatos avatar PanagiotisDrakatos commented on August 16, 2024

@fbacchella Things become even worse when i try localhost on a different machine just with one client.

Here is the server Router part:

package sockets;
import org.zeromq.ZMQ;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Random;
public class Zmq6 {
    static final String URI = "tcp://192.168.1.106:5555";
    static final int NOFLAGS = 0;

    public static class Server implements Runnable {
        public final String name;

        Server(String name) { this.name = name; }

        public void run() {
            ZMQ.Context context = ZMQ.context(1);
            ZMQ.Socket socket = context.socket(ZMQ.ROUTER);
            socket.setImmediate(true);
            socket.setProbeRouter(true);
            socket.bind(URI);

            String address1 = "A";

            long start = System.currentTimeMillis();
            String identity = new String(socket.recv());
            String data1 = new String(socket.recv());
            long finish = System.currentTimeMillis();
            long timeElapsed = finish - start;
            System.out.println(timeElapsed);
            // Wait a second for the workers to connect their sockets.
            System.out.println("Workers started, sleeping 1 second for warmup.");

            socket.send(address1, ZMQ.SNDMORE);
            socket.send("This is the workload.".getBytes(), NOFLAGS);
            socket.close();
            context.term();
        }
    }

    public static void main(String[] args) throws InterruptedException {
        while (true) {
         String address = "A";
         Thread warmup = new Thread(new Server(address));
         warmup.start();
         warmup.join();
        }
    }
}

Here is the client Dealer's part

package io.Adrestus;

import org.junit.jupiter.api.Test;
import org.zeromq.ZMQ;

import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Random;
public class justTest {
    static final String URI = "tcp://192.168.1.106:5555";
    static final int NOFLAGS = 0;
    public static class Worker implements Runnable {
        public final String name;
        private final byte[] END = "END".getBytes();

        Worker(String name) { this.name = name; }

        public void run() {
            ZMQ.Context context = ZMQ.context(1);
            ZMQ.Socket socket = context.socket(ZMQ.DEALER);
            socket.setIdentity(name.getBytes());
            socket.setIdentity(name.getBytes());
            socket.setImmediate(true);
            socket.setProbeRouter(true);
            socket.connect(URI);

            socket.send("Hello1".getBytes(StandardCharsets.UTF_8));
            long start = System.currentTimeMillis();
            byte[] data = socket.recv(NOFLAGS);
            long finish = System.currentTimeMillis();
            long timeElapsed = finish - start;
            System.out.println(new String(data, StandardCharsets.UTF_8)+" "+timeElapsed);
            socket.close();
            context.term();
        }
    }
    @Test
    public void test() throws InterruptedException {
        while (true) {
            String address1 = "A";
            Thread workerA = new Thread(new Worker(address1));
            workerA.start();
            workerA.join();
        }
    }
}

Here is random spike ms:
image

from jeromq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.