rehanift / engine.js

A scriptable task engine
MIT License
23 stars 4 forks source link

Engine.js

The scriptable task engine. A framework for executing user server-side javascript in a safe, scalable way.

What is Engine.js?

Engine.js is a framework for extending web applications to allow users to write their own server-side javascript code to interact with the application. Engine.js lets users create their own functionality within host applications.

When you integrate Engine.js with your web application you must explicitly determine what set of functions users can call from their custom scripts. Implicitly, all Javascript built-in objects are available (though you can explicitly re-define their definitions if you choose to).

Engine.js currently uses Node.js for script evaluation. It has a client library for Node.js (bundled). Ruby and PHP client libraries are planned.

For more information:

Dependencies

Quick Start

Tests

Engine.js has both unit tests (spec/engine) and end-to-end tests (spec/end-to-end). Both types are written with Jasmine and run with jasmine-node.

Benchmarks

Engine.js has a preliminary benchmark script at spec/load/perf_spec.js. The script creates ~ 1000 tasks that add two random numbers together. The script cycles through a variety of transport types (TCP or IPC), number of clients, and number of cylinders. I got the following results on an EC2 c3.xlarge:

[tcp] 1000 tasks from 1 clients against 1 cylinders completed in 16.45 seconds (60 tps)
[ipc] 1000 tasks from 1 clients against 1 cylinders completed in 15.837 seconds (63 tps)
[tcp] 1000 tasks from 1 clients against 2 cylinders completed in 10.132 seconds (98 tps)
[ipc] 1000 tasks from 1 clients against 2 cylinders completed in 9.001 seconds (111 tps)
[tcp] 1000 tasks from 1 clients against 4 cylinders completed in 6.875 seconds (145 tps)
[ipc] 1000 tasks from 1 clients against 4 cylinders completed in 6.879 seconds (145 tps)
[tcp] 1000 tasks from 1 clients against 8 cylinders completed in 6.856 seconds (145 tps)
[ipc] 1000 tasks from 1 clients against 8 cylinders completed in 6.822 seconds (146 tps)
[tcp] 1000 tasks from 1 clients against 16 cylinders completed in 7.033 seconds (142 tps)
[ipc] 1000 tasks from 1 clients against 16 cylinders completed in 7.047 seconds (141 tps)
[tcp] 961 tasks from 31 clients against 1 cylinders completed in 15.821 seconds (60 tps)
[ipc] 961 tasks from 31 clients against 1 cylinders completed in 16.166 seconds (59 tps)
[tcp] 961 tasks from 31 clients against 2 cylinders completed in 9.901 seconds (97 tps)
[ipc] 961 tasks from 31 clients against 2 cylinders completed in 9.327 seconds (103 tps)
[tcp] 961 tasks from 31 clients against 4 cylinders completed in 6.606 seconds (145 tps)
[ipc] 961 tasks from 31 clients against 4 cylinders completed in 6.626 seconds (145 tps)
[tcp] 961 tasks from 31 clients against 8 cylinders completed in 6.571 seconds (146 tps)
[ipc] 961 tasks from 31 clients against 8 cylinders completed in 6.61 seconds (145 tps)
[tcp] 961 tasks from 31 clients against 16 cylinders completed in 6.71 seconds (143 tps)
[ipc] 961 tasks from 31 clients against 16 cylinders completed in 6.727 seconds (142 tps)

tps = tasks per second

Future Plans

License

MIT License

Copyright (C) 2011 by Rehan Iftikhar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.