上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页
摘要: 1、 Volatile的实现原理 2、Synchronized 实现原理 3、线程池的分析和使用 我们可以通过ThreadPoolExecutor来创建一个线程池。 new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime 阅读全文
posted @ 2014-09-10 08:26 lihui1625 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1. 构建哈夫曼代码怎样提升性能? 我们知道在构建哈夫曼树时,每次要选择集合中两个最小的元素,然后将元素值相加,合并为一个新节点,此时两个最小的元素的取出可以用HeapExtractMin函数来实现,产出的新节点需要插入到堆中 我们有MinHeapInsert函数来实现。 之前我们遇到哈夫曼编... 阅读全文
posted @ 2014-09-09 18:32 lihui1625 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 一、堆与栈 1、堆是所有对象共享的,存储对象信息; 每一个线程都有一个独立的线程栈,栈存储的是与当前线程相关的信息,包括局部变量、程序运行状态、方法返回值等。 2、堆中存储的是对象,栈中存储的是基本类型和堆中对象的引用。 3、栈的大小配置 -Xss 4、在运行栈中,基本类型和引用的处理是一样的,都是 阅读全文
posted @ 2014-09-09 18:08 lihui1625 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 当前分布式计算 Web Services盛行天下,这些网络服务的底层都离不开对socket的操作。他们都有一个共同的结构: 1. Read request 2. Decode request 3. Process service 4. Encode reply 5. Send reply 经典的网络 阅读全文
posted @ 2014-09-08 08:23 lihui1625 阅读(118) 评论(0) 推荐(0) 编辑
摘要: http://blog.csdn.net/adermxl/article/details/38686411 java -Xmx3550m -Xms3550m -Xmn2g -Xss128k -Xmx3550m:设置JVM最大可用内存为3550M。 -Xms3550m:设置JVM促使内存为3550m。 阅读全文
posted @ 2014-09-06 12:32 lihui1625 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 添加调试参数: <property> <name>mapred.child.java.opts</name> <value>-Xmx200m-Xdebug-Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=y</value> </p 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 提交作业: hadoop jar /opt/hadoop-1.0.0/hadoop-examples-1.0.0.jar wordcount /user/admin/in/yellow2.txt /user/admin/out/128 生成2个Map、2个Reduce任务。 执行Maps[0]: a 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(103) 评论(0) 推荐(0) 编辑
摘要: 1、启动 HttpServer this.server=new HttpServer("task",httpBindAddress, httpPort, httpPort == 0, conf, aclsManager.getAdminsAcl()); server.start(); 2、生成 De 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 提交作业: hadoop jar /opt/hadoop-1.0.0/hadoop-examples-1.0.0.jarwordcount /user/admin/in/LICENSE.txt /user/admin/out/26 , 只有一个Map任务 server3-RPC请求:getProto 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(115) 评论(0) 推荐(0) 编辑
摘要: JobTracker无任务时处理心跳流程 HeartBeat格式:{restarted=true,initialContact=true,acceptNewTasks=true,responseId=-1, status=TaskTrackerStatus {failures=0,trackerNa 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 2. JobTracker中的容器 2.1 nodesAtMaxLevel、hostnameToNodeMap //(hostname --> Node(NetworkTopology)) Map<String,Node> hostnameToNodeMap = Collections.synchr 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1. JobInProgress中的容器 1.1maps、reduces、cleanup、setup TaskInProgress maps[]= new TaskInProgress[0]; TaskInProgress reduces[]= new TaskInProgress[0]; Task 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 1.初始化和启动JobTracker 生成一个JobQueueTaskScheduler taskScheduler=(TaskScheduler)ReflectionUtils.newInstance(schedulerClass,conf); 生成一个实现 InterTrackerProtoco 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 1. 配置所有节点的$HADOOP_HOME/conf/hadoop-env.sh 文件 exportHADOOP_HOME=/opt/hadoop-1.0.0 exportHADOOP_NAMENODE_OPTS="-Dcom.sun.management.jmxremote.port=9191- 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 命令为: hadoop_debugjar /opt/hadoop-1.0.0/hadoop-examples-1.0.0.jar wordcount/user/admin/in/yellow.txt /user/admin/out/555 首先调用org.apache.hadoop.util.run 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 一、服务器端线程 1、主线程main,启动其余线程后不参与交互 2、1个Listener线程,监听连接请求,并在有连接的时候唤醒Reader线程 public void run() { while(running){ selector.select(); Iterator<SelectionKey> 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 一、服务器端线程 1、主线程main,启动其余线程后不参与交互 2、1个Listener线程,监听连接请求,并在有连接的时候唤醒Reader线程 public void run() { while(running){ selector.select(); Iterator<SelectionKey> 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 考虑一个生产者/消费者模型。 商品类Goods: class Goods { private String name; public Goods(String name) { this.name =name; } public String toString() { return "Goods[" 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 示例代码: public class SyncTest { private List<String> list= new ArrayList<String>(); public void syncAddPrint(){ synchronized(list){ for(int i = 0; i < 1 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 示例代码: public class SyncTest { private List<String> list= new ArrayList<String>(); public void syncAddPrint(){ synchronized(list){ for(int i = 0; i < 1 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(365) 评论(0) 推荐(0) 编辑
摘要: 分析任务reduce_1 args =[127.0.0.1, 42767, attempt_201405060431_0003_r_000001_0,/opt/hadoop-1.0.0/logs/userlogs/job_201405060431_0003/attempt_201405060431_ 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 提交命令行:hadoop jar /opt/hadoop-1.0.0/hadoop-examples-1.0.0.jar wordcount /user/admin/in/yellow.txt /user/admin/out/3 JobTracker已生成JobInProgress(job_2014 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 输入文件:hdfs://server1:9000/user/admin/in/yellow.txt 1.splits formatMinSplitSize:1; minSplitSize=conf("mapred.min.split.size"):1; minSize=Math.max(format 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 提交命令行:hadoop jar/opt/hadoop-1.0.0/hadoop-examples-1.0.0.jar wordcount/user/admin/in/yellow.txt /user/admin/out/3 RPC请求:getProtocolVersion(org.apache.h 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(145) 评论(0) 推荐(0) 编辑
摘要: List<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < 10; i++) { list.add(i); } System.out.println(list); //[0, 1,2, 3, 4, 5, 6, 7, 8, 9] 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(58) 评论(0) 推荐(0) 编辑
摘要: 在MapTask 的spill 阶段会使用快速排序org.apache.hadoop.util.QuickSort : 在QuickSort 中有部分代码,当元素个数小于13时候,使用插入排序 (Insert Sort)。 在QuickSort 中,当栈的层数过多时,使用堆排序(org.apache 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(78) 评论(0) 推荐(0) 编辑
摘要: 原文地址:Proactor和Reactor模式作者:qq俊采星驰 Proactor和Reactor都是并发编程中的设计模式。在我看来,他们都是用于派发/分离IO操作事件的。这里所谓的 IO事件也就是诸如read/write的IO操作。"派发/分离"就是将单独的IO事件通知到上层模块。两个模式不同的地 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 1、MapReduce 运行流程 (1)、JobClient 调用 submitJob(),提交Job (2)、JobClient 向 JobTracker 请求一个新的JobId(调用 JobTracker.getNewJobId() ) (3)、JobClient检查作业的输出说明,计算作业的输 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1、节点介绍 (1)、NameNode管理文件系统的命名空间,维护文件系统树及整棵树内所有的文件和目录,以两个文件形式永久保存在本地磁盘上:命名空间镜像文件fsimage 和 编辑日志文件edits。namenode也记录每个文件中各个块所在的数据节点信息。 (2)、DataNode是文件系统的工作 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(550) 评论(0) 推荐(0) 编辑
摘要: 待续 阅读全文
posted @ 2014-05-28 08:48 lihui1625 阅读(61) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页