微型 java 分布式离线计算框架 tinympi4j

码农软件 · 软件分类 · 大数据 · 2020-02-13 13:59:10

软件介绍

tinympi4j 是一款微型的 java 分布式离线计算框架, 实现原理如图:

特性

  • 简单直观, 没有任何学习难度

  • slave支持多个任务并发/并行执行

  • 使用HTTP协议通信

  • 场景: 找素数/grep/wordcount/超大文件或大量小文件处理

  • 不支持复杂数据类型

  • 没有进度监控,健康监控,无容错功能

例子: 用两台服务器分布式计算找出10000以内的素数

public static void main(String[] args) {
	
		//启动master上的tomcat
		final int masterport = 8086;
		final String masterurl = "http://192.168.1.100:" + masterport;
		TomcatTool.startMasterTomcat(masterport);
	
		//创建任务
		final BigTask<Integer> bigtask = BigTask.create(masterurl);
	
		//添加任务到两台计算节点, 请确保计算节点上的 tinympi4j-slave 已启动
		//关于计算节点: https://github.com/binaryer/tinympi4j-slave
		bigtask.addTask2Slave("http://192.168.1.101:1234", PrimeSplitedtask.class, new Integer[] { 2, 5000 });
		bigtask.addTask2Slave("http://192.168.1.102:1234", PrimeSplitedtask.class, new Integer[] { 5001, 10000 });
	
		//等待所有节点执行完毕
		final Collection<Integer> resultset = bigtask.executeAndWait();
			
		//打印结果
		for (int n : resultset){
			//System.out.println(n);
		}
	}

本文地址:https://codercto.com/soft/d/25524.html

High Performance Python

High Performance Python

Micha Gorelick、Ian Ozsvald / O'Reilly Media / 2014-9-10 / USD 39.99

If you're an experienced Python programmer, High Performance Python will guide you through the various routes of code optimization. You'll learn how to use smarter algorithms and leverage peripheral t......一起来看看 《High Performance Python》 这本书的介绍吧!

URL 编码/解码
URL 编码/解码

URL 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具