EzDevInfo.com

jxcore

Evented IO for SpiderMonkey & V8 JavaScript JXcore · a Node.JS distribution with additional features jxcore (multithreaded node.js) home page

steps to compile Node.js source into byte code and use it

WE had developed a project in nodejs. Client will distribute/sell the application with their clients, hence I must needed to hide them(compile) rather than delivering source code. please provide me proper steps from beginning to compile them, and use them.


Source: (StackOverflow)

Deploying node.js in production (binary form)

So, we are creating a server side app using node.js. The problem is we move the entire code to the Amazon EC2 server and start index.js file using pm2. The question is if this is the best way to do this as anyone with access to the server has the code and the passwords in the clear and can screw up the system.

Is there an option to create a binary and upload that. I have used jxcore, nexe and enclose and they seem to give errors while starting the code.

Can someone please tell me how node.js apps are added in production. Please note that this is not an express app its a pure backend module that the client connects to.

Thanks.


Source: (StackOverflow)

Advertisements

JXcore, How external process monitoring works?

I am a newbie and trying to figure out how process monitoring works with JXcore. I saw the documentation but need few steps in order to make my server application starting multithreaded and monitored properly.

Thanks in advance!


Source: (StackOverflow)

Build native 64bit and 32bit exe with JXCore

I'm looking for a way to builn a native 32bit exe on my 64bit developing machine.

Usually I would run: jx compile .\PhotoFly.jxp But that produces a 64bit version.

Any ideas how to get the 32bit version?


Source: (StackOverflow)

Cannot build JXcore on one of Windows machines

I'm trying to build JXcore on Windows 7 (64 bits).

In fact I have two identical virtual machines, but when i run vcbuild.bat it fails for one of them. I get the following error:

C:\jxcore\vcbuild.bat File "configure", line 339 ''' ^ SyntaxError: Missing parentheses in call to 'print' Failed to create vc project files.

On the second machine I don't have this problem. As far as I remember, I've created them both identical. Where is the problem then?


Source: (StackOverflow)

How to choose between Node.js and JXcore?

JScore seems to be Node.js improved. Check this carefully designed quote:

JXcore comes with a built-in multithreading support that can be enabled on your existing Node.js applications without additional changes... JXcore multithreading may bring aprox. 30 to 50 percent solid performance advantage over Node.JS cluster module. From http://jxcore.com/home/.

I already tried to install it and it does really work. That's all I can say for now, measuring performance and uptime is tricky and elaborative.

So are there real advantages to switch to JXcore and how to make a decision?


Source: (StackOverflow)

How to pass arguments to a JXCore native application?

I created a NodeJS application and I used JXCore with the -native flag to produce a stand alone .exe. Now I'm trying to run the application and to pass some command line arguments.

It is working fine with the NodeJS app but not with the exe:

c:\project> node MyApp.js -arg1 bla
OK.

Works fine. But

c:\project> jx package MyApp.js MyApp -native
c:\project> MyApp.exe -arg1 bla
Error, please provide argument arg1.

I went through the documentation about packaging and some blog posts about the same. I am not able to find how to do it. Any idea?

Thanks!


Source: (StackOverflow)

Node addons available in JXcore using LLVM

I apologize if this is not the correct place to post this question or if it is similar to questions asked before.

I am doing some research into how to put a web interface on a C++ project I want to start. I came across Node.js and checked out a few of the addons using the V8 engine.

My idea is to route business logic (DB(sqlite), CRM, CMS, etc) to the C++ backend and handle stuff like websocket connections, form validations, etc. within Node.

JXcore has very appealing specs on paper so I am very interested in trying it out, but I am unsure about how my addon will be affected seeing that JXcore has a future objective to move from V8 to LLVM. Hopefully there will be options available to bridge JS with C++.

So, based on the above, I have the following options available:

  1. do everything in Node (no C++ addon)
  2. use JXcore or Node and c++ addon without multithreading
  3. use JXcore or Node and implement multithreading in my C++ addon using libuv for instance
  4. do everything in JXcore (no C++ addon)

Which one of the options above would be the better route to go with in regards to performance, in your opinion? I would also appreciate any alternative options to the above.


Source: (StackOverflow)

JXCore packaging, NPM errors

When I compile code with

\> jx package bin/www.js myApp

\> packaging...
\> [OK] compiled file is ready (myApp.jx)

it successfully created myApp.jx and myApp.jxp But when I executed command

\> jx myApp.jx
It gives errors as:

C:\**\node_modules\express-session\node_modules\debug*node.js.jx*:72 exports.formatters.o = function(v) { ^ TypeError: Cannot set property 'o' of undefined at Object. (C:\**\node_modules\express-session\node_modules\debug\node.js.jx:72:22)
at Module._compile (module.js:519:26)
at Object.Module._extensions..jx (module.js:1604:7)
at Module.load (module.js:346:36)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:378:17)
at require (module.js:396:17)
at Object. (C:\**\node_modules\express-session*index.js.jx:17:13*)
at Module._compile (module.js:519:26)
at Object.Module._extensions..jx (module.js:1604:7)
at Module.load (module.js:346:36)
at Function.Module._load (module.js:313:12)
at Module.require (module.js:378:17)
at require (module.js:396:17)
at Object. (C:\***server.js.jx*:7:15)
at Module._compile (module.js:519:26)


Source: (StackOverflow)

Node.js stream write in loop

I was trying to benchmark some node.js native functionalities lately and found out some creepy results I cannot understand. Here's a simple code that I benchmarked and benchmark results:

http://pastebin.com/0eeBGSV9

You can see that it did healthy 8553 requests per second on 100k requests with 200 concurrency. I was then instructed by a friend, that I shouldn't be using async in this case, as this loop isn't big enough to obstruct event loop of node, so I refactored code to use for loop and it increased the benchmark result even higher:

http://pastebin.com/0jgRPNEC

Here we have 9174 requests per second. Neat. (for loop version was consistently faster than async version even when I changed the amount of iterations to 10k, curiously enough).

But then my friend wandered if this result could be pushed even further by use of streaming instead of dumping all data after loop has finished. Once again, I refactored code to use res.write to handle data output:

http://pastebin.com/wM0x5nh9

aaaaand we have 2860 requests per second. What happened here? Why is stream writing so sluggish? Is there some kind of error in my code or is this how node actually works with streams?

Node version is 0.10.25 on ubuntu with default settings from apt installation.

I also tested the same code against JXCore and HHVM (using async.js version of node code) in the beginning with results here: http://pastebin.com/6tuYGhYG and got a curious result of node cluster being faster than latest jxcore 2.3.2.

Any critique would be greatly appreciated.

EDIT: @Mscdex, I was curious if calling res.write() might have been the issue, so I changed the way I pushed out data to a new stream made for consumption by res. I believed, naively, that maybe this way node will somehow optimize output buffering and stream data in an effective way. While this solution worked too, it was even slower than before:

http://pastebin.com/erF6YKS5


Source: (StackOverflow)

How to reset a multithreaded task? (JXcore)

I have a node.js application that I've moved into JXcore multithreading and yet couldn't figure out how to reset a task. On the current implementation, the server creates a sub process and send the jobs one by one.

When a job takes more than X seconds, the main process kills the sub process and skips the running task and logs it. Any of the jobs shouldn't take more than X seconds.

So far, I already moved the queue system into JXcore easily and it works as expected but I couldn't figure out yet, how can I kill the running task.


Source: (StackOverflow)

usage of jxcore packaging?

I am curious to know the usage of packaging the node application into .jx and .jxp format using JXcore.

As I gone through this document, it is converting application into binary format for code protection.

Is there any other usage other than this?


Source: (StackOverflow)

Port Cordova plugin(database API) to Node.Js module?

I am using Couchbase products as a database to develop a suite of applications (mobile, web, desktop) with offline capability. Our app will be a Html + Css + Javascript that should be cross platform. Angular and PhoneGap also used for being able to use a MVC pattern and build for mobile.

We want to also use JxCore (Node.Js fork) as a separate back-end service that would talk with the Couchbase Server or Couchbase Lite depending on the type of the app. (WebApp would talk directly with the Couchbase Server hosted on a cluster and apps that are deployed on client devices will need to talk to Couchbase Lite(embedded) and sync with the Couchbase Server.

Currently Couchbase offers a SDK for Node.Js to talk to the Couchbase Server, but not something similar for Couchbase Lite. PhoneGap on the other side, has a plugin for Couchbase Lite but like I said before we would prefer a backend node.js that will talk with the database and expose a rest API which will be called by the client apps to work with the data in the database.

Is there any possibility I can adapt this Couchbase Lite plugin so I can use it with Node.js (don't worry that this plugin dont have any desktop platform, we can solve this).

Link to the Couchbase Lite Plugin: https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin

Link to JxCore Plugin we use: https://github.com/jxcore/jxcore-cordova

I don't know if this is doable, I am a dummy working with those technologies. Please let me know if I need to clarify something, thanks!


Source: (StackOverflow)

Jxcore add new task parallel

I'm using jxcore to execute a job in parallel. But when I test as below

var method = function () {
   var sleep = require('sleep');
   console.log("thread started", process.threadId);
   sleep.sleep(2);
   console.log("thread finished", process.threadId);
};

jxcore.tasks.addTask(method);
jxcore.tasks.addTask(method);
jxcore.tasks.addTask(method);
jxcore.tasks.addTask(method);

Result seems just 1 thread is used :

thread started 0
thread finished 0
thread started 0
thread finished 0
thread started 0
thread finished 0
thread started 0
thread finished 0

I expect , it create 4 thread start parallel. How can i achieve it ?


Source: (StackOverflow)

JXcore throw error when add task

I got this error when I was trying to use jxcore.tasks.addTask function in my program.

undefined:1
function (){}
 ^
SyntaxError: Unexpected token u
    at Object.parse (native)
    at gcc (_jx_tasks.js:130:24)
    at process.<anonymous> (_jx_tasks.js:425:3)
    at process.emit (events.js:106:17)
    at process.__makeCall (node.js:420:23)

I'm not sure that jxcore.tasks.addTask function makes it or not, it's only happened when I declare a new prototype for Array. Simple code below in my program throw this error:

Array.prototype.doSomething = function(){};
jxcore.tasks.addTask(function () {}, {}, function () {});

Source: (StackOverflow)