Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extremely slow on Windows 7? #276

Closed
ClosetGeek-Git opened this issue Sep 3, 2018 · 4 comments
Closed

extremely slow on Windows 7? #276

ClosetGeek-Git opened this issue Sep 3, 2018 · 4 comments

Comments

@ClosetGeek-Git
Copy link

I am currently experimenting between PHP 7.2 and NodeJS 8.11. I am using a PUSH socket on node to push to a PHP worker, then pushing back into the same node script/process. When pushing from PHP to PHP and back I am able to do 50,000 simple echos in 7.0008 seconds. However when pushing from NodeJS to PHP and back it takes 4.5240 seconds for just 1,000 echos. I don't see how this can be an PHP vs. NodeJS issue, but most likely a matter of the extensions, admittedly user error (myself...) specifically. Are there common pitfalls that I should be looking out for? My NodeJS script (too lazy to get formatting right in git editor)

`
var zmq = require('zeromq')
, zmq_push_socket = zmq.socket('push')
, zmq_pull_socket = zmq.socket('pull');

zmq_pull_socket.on('message', function(buf) {
    var msg = buf.toString();
    
    if(msg != "+")
    {
    }
    
    zmq_push_socket.send("test");
});

zmq_push_socket.bindSync("tcp://*:5570");
zmq_pull_socket.bindSync("tcp://*:5571");

`
The PHP script - virtually the same

`<?php

include 'zmsg.php';

$context = new ZMQContext();

$zmq_push_socket = new ZMQSocket($context, ZMQ::SOCKET_PUSH);
$zmq_push_socket->bind("tcp://*:5570");

$zmq_pull_socket = new ZMQSocket($context, ZMQ::SOCKET_PULL);
$zmq_pull_socket->bind("tcp://*:5571");

$read = $write = array();

while (true)
{
$poll = new ZMQPoll();
$poll->add($zmq_pull_socket, ZMQ::POLL_IN);

$poll->poll($read, $write);
foreach ($read as $socket)
{
	$msg = $socket->recv();
	
	if($msg != "+")
	{
	}
	
	$zmq_push_socket->send("test");		
}

}
`

I am on Windows 7 64 bit, libzmq version is 4.2.3, PHP ZMQ extension version is 1.1.3, node zeromq module version is 4.6.0. current system is core duo (two core @ 3.0 Ghz) with 4 gigs ram.

@ClosetGeek-Git
Copy link
Author

I'll try this out on Ubuntu tomorrow but would love to know if I'm doing something wrong where this Windows box is concerned.

@ClosetGeek-Git
Copy link
Author

Also, I tried https://www.npmjs.com/package/zmq to almost identical results

@rolftimmermans
Copy link
Member

Recently we have released 6.0 beta. It features a new API that addresses some fundamental issues with the previous API and also addresses a number of stability bugs. To make upgrading easier it includes a compatibility layer with versions 4.x/5.x. It would be great if you could give the latest version a spin to see if this solves this particular issue. If you run into any problems with it, feel free to report it here or in a new issue.

@aminya
Copy link
Member

aminya commented Aug 13, 2024

v6 was released. Please try again with the latest version, and report back if the issue still persists.
https://github.com/zeromq/zeromq.js/releases/tag/v6.0.0

@aminya aminya added the wontfix label Sep 16, 2024
@aminya aminya closed this as completed Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants