All Projects → amphp → Parallel

amphp / Parallel

Licence: mit
Parallel processing for PHP based on Amp.

Projects that are alternatives of or similar to Parallel

Parallel-NDJSON-Reader
Parallel NDJSON Reader for Python
Stars: ✭ 13 (-97.28%)
Mutual labels:  multiprocessing, parallel, parallel-processing
java-multithread
Códigos feitos para o curso de Multithreading com Java, no canal RinaldoDev do YouTube.
Stars: ✭ 24 (-94.98%)
Mutual labels:  concurrency, parallel, parallel-processing
Hamsters.js
100% Vanilla Javascript Multithreading & Parallel Execution Library
Stars: ✭ 517 (+8.16%)
Mutual labels:  concurrency, parallel, parallel-processing
Linux-Kernel-Driver-Programming
Implementation of PCI drivers, kprobe, sysfs, devfs, sensor driver, miscdevices, synchronization
Stars: ✭ 43 (-91%)
Mutual labels:  concurrency, parallel
YACLib
Yet Another Concurrency Library
Stars: ✭ 193 (-59.62%)
Mutual labels:  concurrency, parallel
bascomtask
Lightweight parallel Java tasks
Stars: ✭ 49 (-89.75%)
Mutual labels:  concurrency, parallel
Spring Boot Data Aggregator
基于注解实现并行地依赖注入(数据聚合),可以看做 Spring Async 注解的升级版
Stars: ✭ 142 (-70.29%)
Mutual labels:  concurrency, parallel-processing
gitall.rs
Run Git commands in all subdirectories really fast
Stars: ✭ 25 (-94.77%)
Mutual labels:  parallel, parallel-processing
thread-pool
BS::thread_pool: a fast, lightweight, and easy-to-use C++17 thread pool library
Stars: ✭ 1,043 (+118.2%)
Mutual labels:  concurrency, parallel
ProtoPromise
Robust and efficient library for management of asynchronous operations in C#/.Net.
Stars: ✭ 20 (-95.82%)
Mutual labels:  concurrency, parallel
go-worker-thread-pool
A visual working example of a Thread Pool pattern, based on a known blog article.
Stars: ✭ 24 (-94.98%)
Mutual labels:  concurrency, parallel
wasm-bindgen-rayon
An adapter for enabling Rayon-based concurrency on the Web with WebAssembly.
Stars: ✭ 257 (-46.23%)
Mutual labels:  concurrency, parallel
Corium
Corium is a modern scripting language which combines simple, safe and efficient programming.
Stars: ✭ 18 (-96.23%)
Mutual labels:  concurrency, parallel
Vermin
Concurrently detect the minimum Python versions needed to run code
Stars: ✭ 218 (-54.39%)
Mutual labels:  concurrency, multiprocessing
noroutine
Goroutine analogue for Node.js, spreads I/O-bound routine calls to utilize thread pool (worker_threads) using balancer with event loop utilization. 🌱
Stars: ✭ 86 (-82.01%)
Mutual labels:  concurrency, parallel
Util
A collection of useful utility functions
Stars: ✭ 201 (-57.95%)
Mutual labels:  concurrency, parallel
Curl Easy
cURL wrapper for PHP. Supports parallel and non-blocking requests. For high speed crawling, see stil/curl-robot
Stars: ✭ 297 (-37.87%)
Mutual labels:  parallel, multiprocessing
Sorty
Fast Concurrent / Parallel Sorting in Go
Stars: ✭ 74 (-84.52%)
Mutual labels:  concurrency, parallel
Axeman
Axeman is a utility to retrieve certificates from Certificate Transparency Lists (CTLs)
Stars: ✭ 125 (-73.85%)
Mutual labels:  concurrency, multiprocessing
think-async
🌿 Exploring cooperative concurrency primitives in Python
Stars: ✭ 178 (-62.76%)
Mutual labels:  multiprocessing, concurrency

parallel

Build Status Code Coverage Release License

amphp/parallel provides true parallel processing for PHP using multiple processes or native threads, without blocking and no extensions required.

To be as flexible as possible, this library comes with a collection of non-blocking concurrency tools that can be used independently as needed, as well as an "opinionated" worker API that allows you to assign units of work to a pool of worker threads or processes.

Installation

This package can be installed as a Composer dependency.

composer require amphp/parallel

Usage

The basic usage of this library is to submit blocking tasks to be executed by a worker pool in order to avoid blocking the main event loop.

<?php

require __DIR__ . '/../vendor/autoload.php';

use Amp\Parallel\Worker;
use Amp\Promise;

$urls = [
    'https://secure.php.net',
    'https://amphp.org',
    'https://github.com',
];

$promises = [];
foreach ($urls as $url) {
    $promises[$url] = Worker\enqueueCallable('file_get_contents', $url);
}

$responses = Promise\wait(Promise\all($promises));

foreach ($responses as $url => $response) {
    \printf("Read %d bytes from %s\n", \strlen($response), $url);
}

file_get_contents is just used as an example for a blocking function here. If you just want to fetch multiple HTTP resources concurrently, it's better to use Artax, our non-blocking HTTP client.

The functions you call must be predefined or autoloadable by Composer so they also exist in the worker processes. Instead of simple callables, you can also enqueue Task instances with Amp\Parallel\Worker\enqueue().

Documentation

Documentation can be found on amphp.org/parallel as well as in the ./docs directory.

Versioning

amphp/parallel follows the semver semantic versioning specification like all other amphp packages.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

The MIT License (MIT). Please see LICENSE for more information.

Development and Contributing

Want to hack on the source? A Vagrant box is provided with the repository to give a common development environment for running concurrent threads and processes, and comes with a bunch of handy tools and scripts for testing and experimentation.

Starting up and logging into the virtual machine is as simple as

vagrant up && vagrant ssh

Once inside the VM, you can install PHP extensions with Pickle, switch versions with newphp VERSION, and test for memory leaks with Valgrind.

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].