Comments (6)
Did you try with Epsilon: A No-Op Garbage Collector ?
from jeromq.
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.
@fbacchella I have been using this
-XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC
but the problem still persists any other possible solutions?
Thanks in advance
from jeromq.
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.
@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.
@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();
}
}
}
from jeromq.
Related Issues (20)
- 0.5.4 and 0.6 versions HOT 3
- MsgsendBlockAndCpuIs100% HOT 7
- ipc HOT 3
- New client cannot receive any data in PUB/SUB mode HOT 1
- How to split `ZMsg` in reply envelope and request? HOT 1
- reaper-1 thread consuming 99.9% CPU HOT 2
- DEALER recv sometimes hangs HOT 5
- Export own and subscription addresses for testing HOT 3
- [Question] Message Persistence HOT 6
- Expected DISCONNECTED event not received
- A command error message on console HOT 6
- help my keeps crashing when starting up (Not longer in use) HOT 5
- LocketteX plugin error on console HOT 1
- -
- NullPointerException: Cannot invoke "zmq.IMailbox.send(zmq.Command)" because "this.slots[tid]" is null HOT 4
- ZMonitor stuck on close HOT 2
- SocketType HOT 3
- The server cannot receive messages after running for a period of time HOT 1
- Router hangs in send() after client disconnects / doesn't return EHOSTUNREACH HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jeromq.