All Projects → keyvank → pooljs

keyvank / pooljs

Licence: Apache-2.0 license
Browser computing unleashed!

Programming Languages

CSS
56736 projects
python
139335 projects - #7 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to pooljs

MultiHttp
This is a high performance , very useful multi-curl tool written in php. 一个超级好用的并发CURL工具!!!(httpful,restful, concurrency)
Stars: ✭ 79 (+364.71%)
Mutual labels:  parallel, multithreading
Hamsters.js
100% Vanilla Javascript Multithreading & Parallel Execution Library
Stars: ✭ 517 (+2941.18%)
Mutual labels:  parallel, multithreading
Taskflow
A General-purpose Parallel and Heterogeneous Task Programming System
Stars: ✭ 6,128 (+35947.06%)
Mutual labels:  parallel, multithreading
pblat
parallelized blat with multi-threads support
Stars: ✭ 34 (+100%)
Mutual labels:  parallel, multithreading
Pelagia
Automatic parallelization (lock-free multithreading thread) tool developed by Surparallel Open Source.Pelagia is embedded key value database that implements a small, fast, high-reliability on ANSI C.
Stars: ✭ 1,132 (+6558.82%)
Mutual labels:  parallel, multithreading
Corium
Corium is a modern scripting language which combines simple, safe and efficient programming.
Stars: ✭ 18 (+5.88%)
Mutual labels:  parallel, multithreading
Optuna
A hyperparameter optimization framework
Stars: ✭ 5,679 (+33305.88%)
Mutual labels:  parallel, distributed
java-multithread
Códigos feitos para o curso de Multithreading com Java, no canal RinaldoDev do YouTube.
Stars: ✭ 24 (+41.18%)
Mutual labels:  parallel, multithreading
Openmp Examples
openmp examples
Stars: ✭ 64 (+276.47%)
Mutual labels:  parallel, multithreading
Xyzpy
Efficiently generate and analyse high dimensional data.
Stars: ✭ 45 (+164.71%)
Mutual labels:  parallel, distributed
wasm-bindgen-rayon
An adapter for enabling Rayon-based concurrency on the Web with WebAssembly.
Stars: ✭ 257 (+1411.76%)
Mutual labels:  parallel, multithreading
Lightgbm
A fast, distributed, high performance gradient boosting (GBT, GBDT, GBRT, GBM or MART) framework based on decision tree algorithms, used for ranking, classification and many other machine learning tasks.
Stars: ✭ 13,293 (+78094.12%)
Mutual labels:  parallel, distributed
optuna-examples
Examples for https://github.com/optuna/optuna
Stars: ✭ 238 (+1300%)
Mutual labels:  parallel, distributed
distributed
Library to provide Erlang style distributed computations. This library is inspired by Cloud Haskell.
Stars: ✭ 49 (+188.24%)
Mutual labels:  parallel, distributed
kafka-workers
Kafka Workers is a client library which unifies records consuming from Kafka and processing them by user-defined WorkerTasks.
Stars: ✭ 30 (+76.47%)
Mutual labels:  parallel, multithreading
Poshrsjob
Provides an alternative to PSjobs with greater performance and less overhead to run commands in the background, freeing up the console and allowing throttling on the jobs.
Stars: ✭ 447 (+2529.41%)
Mutual labels:  parallel, multithreading
OpenABL
A domain-specific language for parallel and distributed agent-based simulations.
Stars: ✭ 24 (+41.18%)
Mutual labels:  parallel, distributed
ParallelUtilities.jl
Fast and easy parallel mapreduce on HPC clusters
Stars: ✭ 28 (+64.71%)
Mutual labels:  parallel, distributed
Ems
Extended Memory Semantics - Persistent shared object memory and parallelism for Node.js and Python
Stars: ✭ 552 (+3147.06%)
Mutual labels:  parallel, multithreading
Napajs
Napa.js: a multi-threaded JavaScript runtime
Stars: ✭ 8,945 (+52517.65%)
Mutual labels:  parallel, multithreading

alt text

Pool.js

What is Pool.js?

Pool.js is a JavaScript platform for Distibuted Browser Computing. The platform consists of the Pool.js Server which handles the connections and distributes the tasks between the Processors, which are the browsers connected to the Pool.js Server (And they may have multiple cores) in order to run distributed scripts and the Clients which run their scripts on the Processors.

For a browser to be a Processor, it should run the script located at: https://pooljs.ir/static/js/processor.js This script establishes a WebSocket connection to the Pool.js Server and fetches the SubProcesses and distributes them between the hosting machine's CPU cores.

A SubProcess is a single JavaScript function and its arguments, which returns part of the solution of a bigger problem.

One can add <script src="https://pooljs.ir/static/js/processor.js"></script> to his website so that every visitor of that website become a Pool.js Processor.

In order for the clients to run their scripts on the Pool.js Processors, they should run the script located at https://pooljs.ir/static/js/pool.js There are three library functions provided in this script for producing SubProcesses. All these functions accept a function which returns the result of the SubProcess as an object, as their first argument and they will return an object having a function named result() which accepts a callback and invokes it whenever a SubProcess has been done.

Consider the problem finding prime numbers between 1 to 1000, distributing the task between 10 browsers would be something like this:

Single process

for(var i = 0;i < 10; i++)
	pool.run(function(from,to){
		// Finding primes
	},[i*100,(i+1)*100]).result(function(primes){
		console.log(primes);
	});
}

pool.run(func,args /* Optional */); accepts a single SubProcess and posts it to the pool of Processors (You may also provide the arguments of this function as a list which in the example above two arguments specifying the range of numbers to search are provided)

Parallel for loop

pool.for(0,10,function(i){
	var from = i*100;
	var to = (i+1)*100;
	// Finding primes
}).result(function(primes){
	console.log(primes);
});

pool.for(from,to,func,extraArgs /* Optional */); is a parallel for loop which accepts a range and a function then creates multiple SubProcesses running in parallel for each index in the range. An index variable is provided to the function automatically as the index of the for loop. (You may also provide extra arguments for your function appearing after the index argument by setting the extraArgs argument to a list of objects)

Parallel for-each loop

pool.forEach([0,1,2,3,4,5,6,7,8,9],function(obj){
	var from = obj*100;
	var to = (obj+1)*100;
	// Finding primes
}).result(function(primes){
	console.log(primes);
});

pool.forEach(argsList,func,extraArgs /* Optional */); is a parallel for-each loop which accepts the list of object to be iterated and a function then creates multiple SubProcesses running in parallel for each object in the list provided. The first argument of the function provided is set to one of the objects in the list of objects provided. (You may also provide extra arguments for your function appearing after the first argument by setting the extraArgs argument to a list of objects)

Passing data

Notice that you can't use variables outside the scope of parallel function and you should pass them to the function as extra arguments like this:

var myVar1 = 2;
var myVar2 = [1,2,3];
pool.for(0,10,function(i,myVar1,myVar2){
	// Blah blah blah
}, [myVar1,myVar2]).result(function(){
	// Blah blah blah
});

Buffering

pool.setBufferSize(size); lets you set a buffer for the results of your SubProcesses in order to reduce the number of WebSocket messages. Pool.js Server will automatically flush the buffer when it is full. If the buffer is not yet full and you need the results you should call the pool.flush() function to manually flush the buffer.

pool.flush(); manually flush the result buffer in Pool.js Server.

Contribution

You can help this project by creating cool stuff on top of it!

Build status

Build Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].