Hi,
We are experimenting with the rticonnextdds_connector with node.js. Due to some legacy reason, we need more than 10 participants from different domains. However, node.js has a single process. On our 64-bit Ubuntu 14.04, the maximum number of participants was limited to 8.
In order to increase the number of participants, we would have to change the resource_limits.max_objects_per_thread of DDS_DomainParticipantFactoryQos. The api to access DDSDomainParticipantFactory is not exposed in the connector.
Is is possible to use c++ addon to access the DDSDomainParticipantFactory and change the resource limits?
The following was one such atempt:
#include <node.h> #include <v8.h> #include <ndds/ndds_cpp.h> using namespace v8; Handle<Value> Method(const Arguments& args) { // The following is the dds code DDS_DomainParticipantFactoryQos factoryQoS; DDSTheParticipantFactory->get_qos(factoryQoS); /* increase max_objects_per_thread as needed. * The default is 1024 (512 for 4.4c and below). */ factoryQoS.resource_limits.max_objects_per_thread = 4096; DDSTheParticipantFactory->set_qos(factoryQoS); HandleScope scope; return scope.Close(String::New("true")); } void Init(Handle<Object> exports) { exports->Set(String::NewSymbol("dds_resource_init"), FunctionTemplate::New(Method)->GetFunction()); } NODE_MODULE(dds_resource_init, Init)
In the javascript:
var dds_init = require('bindings')('dds_resource_init'); console.log('increase dds resource limits');
was called before the
var rti = require('rticonnextdds-connector'); var connector = new rti.Connector("myqos.xml");
The c++ addon was compiled with:
gyp info using node-gyp@0.10.10
gyp info using node@0.10.25 | linux | x64
So far, such approch has not worked for us.
Is this approach fundamentally wrong?
Any suggestions will be appreciated!
Hello Jiqi,
Hello Jiqui,
I was able to reproduce your issue and create a solution using your brilliant approach. Let me write down what I did so we have track of it.
I created my addon in a file called init_factory.cc that i compile using the spec in binding.gyp. I then used the modifed ShapeExample.xml that you shared with me and the modified writer.js.
You can find all the files here: https://gist.github.com/gianpiero/994bdc4c2b40480050e7fb31864ae98c
I was able to run successfuly. Changing
leads to the erros:
Hi Gianpiero,
The approach finally worked for me on Ubuntu 14.04. As stated before, I am using the default nodejs and node-gyp for Ubuntu 14.04. The nodejs and node-gyp are a bit outdated now.
gyp info using node-gyp@0.10.10
gyp info using node@0.10.25 | linux | x64
My compiler is gcc 4.8.4. The rticonnextdds-connector was upgraded to 0.3.0. And the rti dds was upgraded to 5.3.0. The DDS api was switched to C. The addon is as follows:
The binding.gyp was modified as follows:
A final note is that the calling script must be located at correct directory level. Otherwise, the addon will have difficulties to load the shared lib.
Thanks for the support!
For anybody else running into this issue. In the Connector 1.0.0 release we added a new API to both the Python Connector and JavaScript Connector which can be used to configure the max_objects_per_thread. In both cases, it can only be called before a Connector is created.