- 博客(53)
- 资源 (18)
- 问答 (2)
- 收藏
- 关注
原创 关于静态页面缓存的几点总结
1.列表页原子操作问题我们使用的nginx proxy cache,每次只能purge(过期)一个页面。发现页,热门,如果不同时purge,会出现新老交替的瞬间。没有主动过期概率更高。阅读nginx proxy cache代码,知道hash规则,删除文件。可以用nginx插件实现。2.缓存什么像大量的用户,专辑页,如果都缓存代价很高,是否只缓存首页。只缓存第一页。3.缓存过期问题被动过...
2013-11-29 16:54:00 374
2013 ADC阿里技术嘉年华所见所思
回来时候,发现会场听讲的会议记录的笔记本丢了,写了满满一本。就凭记忆写一些东西吧。 1.android插件化 插件化框架组开发定制了自己的dexloader,resource loader,如果发现插件或者资源有更改,就自动更新。有校验机制,母包会对子包记性校验,大概是母包对子包进行签名,接着dexloader加载时用母包的公钥解密,得到插件指纹,对插件指纹进行校验,如果插件有任...
2013-07-15 01:19:24 184
Java进程CPU100%的问题
今天review了一下测试环境,后来发现一个java进程CPU 120%多,4核的CPU,很多人都没感觉。但是确实是很大问题。测试环境没什么并发,也没什么数据量怎么会这么高的cpu呢? 找到java进程中耗cpu最高的nid,top –p pid –H 用jstack或者其他方式打印一下线程堆栈,从堆栈记录里找出nid,对应的线程和他的堆栈。找到出问题的方法。有这么一段代码...
2013-01-14 17:48:38 175
满篇的fullgc
今天,抽空review一下测试环境。看了一下gc日志,乖乖,满篇的full gc。 用jstat –gcutil PID查了一下,发现确实fgc的count是ygc的4倍。为什么都跑到老年代了。然后看了tomcat启动设置,发现不知一哥们把xmn配成了256m。问他为什么这么设置。说配小了就可以不停的YGC,FGC就没有了。 我怔住了,竟然能这么理解,YGC是增多了,短期对象都跑...
2013-01-14 17:39:38 148
开源android推送服务androidpn修改点
花了几天时间,对androidpn的源代码进行了阅读,并修改了一些必要的功能。 服务端:1.用户认证策略改为用device id和token。token是用户登陆应用成功后生成的,device id是一台机器的UUID。一个用户会绑定到多个device,和网站本身验证机制整合。2.添加调整mina线程池的参数3.去除提供的console,太危险4.修改加载配置文件的方式,原...
2012-12-23 23:18:02 125
原创 Rabbitmq使用小结
1. 神奇的现象今天发布版本时,重启了整个rabbitmq集群,发现有的模块和rabbitmq中的exchange解绑了。而且启动时并没有自动绑定。有个同事有十几个queue,全部手动绑定了一下。导致上线时间多花了10多分钟。现象描述:queue和exchange自动解绑启动时没有自动绑定queue 2. 背后的故事rabbitmq我们采用的是fanout exc...
2012-11-01 22:56:03 117
用maven的ant run插件自动部署MR job依赖的jar到HDFS
背景远程提交MR job时将MR job依赖的所有jar都发布到HDFS中,同时将这些jar加到hadoop job的classpath上。如果每次手动上传就太费劲。项目集成maven。所以打算在maven package时将所有jar通过脚本上传到远程HDFS上 编写ant脚本使用了,haddop的ant 插件。说白了就是一些util方法,调用了fsshell。没...
2012-09-07 20:37:41 171
多客户端同时登录向下查看更多翻页
分页逻辑:1.向下翻滚动条,查看更多2.旧的内容和新的内容会合并,多条会合成一条,放在第一条,便于用户查看信息3.不允许两页出现重复,特别是手机scroll view出现重复就太难看了。解决方法:1.为了分页显示正确,在翻页时不出现重复(翻页是向下查看更多的方式),现在是记录未读数,在获取第二页时是pagenumber×pagesize+unread。如果有新的内...
2012-09-04 17:57:06 261
原创 远程提交Map/Reduce任务
1. 将开发好MR代码打包成jar。添加到distributed cache中。 bin/hadoop fs -copyFromLocal /root/stat-analysis-mapred-1.0-SNAPSHOT.jar /user/root/lib 2. 在服务器端创建和你客户端一模一样的用户。创建目录 /tmp/hadoop-root/stagging/用户 ...
2012-08-28 21:20:00 97
Lucene sort
Lucene sort:1.索引顺序 2.相关度 3.sort field 4.custom sort (comparator) 5.function query(score函数) 6.boost(norm) 7.custom collector。 他们各有所长,有的耗cpu时间,有的耗索引大小。...
2012-06-24 15:43:07 127
原创 最近分表的一点感想
1. 都是基于散列算法分表,有两种不同的方法, 一种取模法,但是取模也是先预估100张,也可以先用10张,10张表相当于0, 9,19, 29等,如果模下来的在5就寻址到值为9的那张表,这样即使加入新的10张表也只要迁移部分数据。 二种一致性hash,按100张表为例,每个物理节点增加10个虚拟节点。不要舍不得增加虚拟节点,直到算出来的节点比较平均就可以了。 2. 数据不要舍不...
2012-06-15 08:08:03 98
MySQL,一条两层subquery的坑爹优化
最近整一些见不得人的事情,每天都忙到很晚。悲剧。 SELECT a.client_id, s.cnt s_cnt, a.cnt a_cnt, s.cnt / a.cnt s_rateFROM (SELECT COUNT(*) cnt, handle_client client_id F...
2012-03-23 15:00:57 745
C# Webbrowser控件使用多代理的问题
C# webbroser控件有限制(可能浏览器控件都有这个限制),黑盒的情况下不能修改header,是只读的方式。只能全局通过DLL的开放的接口修改整个进程的header信息和代理信息。而webbrowser是可以多线程的,我们现在是一个独立业务使用一个webbrowser。将来或使用webrowser池,这时候proxy接收到的数据需要修改然后传给相应的发送者,按照前面所说,proxy...
2011-10-20 08:16:55 247
Java爬虫框架(三)--模块设计之二
6. FilterFilter可以对解析好的新Task,进行过滤。 7. HandlerHandler对解析好的内容进行进一步处理,异步化处理和爬取解析。处理主要是将爬取的数据入库和索引。 一、 Task队列Task队列,存放还没有被处理的新任务。 二、 Visited表Visited...
2011-08-18 07:02:47 128
Java爬虫框架(二)--模块设计之一
一、 模块1. SchedulerScheduler负责启动爬虫,停止爬虫,监控爬虫的状态。 Scheduler在调度爬虫时,借助于Quartz,设置爬虫在某个时刻启动。同一个名字的爬虫是stateful的。Task:初始化任务。Trigger: 触发器,描述何时触发爬虫。开放Scheduler远程API,可以通过爬虫配置管理平台管理...
2011-08-18 06:57:38 216
Java爬虫框架(一)--架构设计
一、 架构图那里搜网络爬虫框架主要针对电子商务网站进行数据爬取,分析,存储,索引。 爬虫:爬虫负责爬取,解析,处理电子商务网站的网页的内容数据库:存储商品信息索引:商品的全文搜索索引Task队列:需要爬取的网页列表Visited表:已经爬取过的网页列表爬虫监控平台:web平台可以启动,停止爬虫,管理爬虫,task队列,visited表。...
2011-08-18 06:43:59 416
Hyperic插件开发不完全指南(四)--Mbean插件之二
(1) 配置plugin descriptorService可以引用server的配置。Server相当于service的parent。<?xml version="1.0"?><plugin package="org.hyperic.hq.plugin.monitor"> <classpath> <in...
2011-08-17 22:08:23 127
Hyperic插件开发不完全指南(五)--其他插件
1. hyperic SQL 插件SQL plugin功能就是定义一个查询,将DB中的值不停的查出来,收集显示,报警。<plugin> <service name="testSql"> <!-- config defined by the sqlquery-plugin --> <config inc...
2011-08-17 21:58:10 131
Hyperic插件开发不完全指南(三)--Mbean插件(一)
1. hyperic JMX插件作为java为服务端语言的web项目,JMX MBean是监控管理很好的选择。Hyperic可以很容易地mbean集成进来。Hyperic可以自动发现定义好的Mbean服务类型的服务。 JMX监控插件开发步骤(1) 设计好自己所要监控的业务逻辑,开发Mbean我们可以借助Spring JMX来开发Mbean。Spring可以将s...
2011-08-17 21:48:55 152
Hyperic插件开发不完全指南(二)--插件进阶
1. Hyperic插件Hyperic是插件式的。从层次模块划分:配置(product plugin),服务发现(detector),数据收集也称为monitor(collector, measurement),事件跟踪(track),报警,处理(control),UI(HQU)。从功能模块划分:JMX, Script,SQL Query,SNMP等插件,往往一个功能模块包含...
2011-08-17 21:44:48 204
Hyperic插件开发不完全指南(一)--Hyperic入门与安装
1. hyperic简介Hyperic HQ是一个基于java的监控软件,由一个中心监控服务器和一个或多个远程代理组成,远程代理用来向服务器报告节点信息。 Hyperic的特点1. 分布式架构2. 开源3. 被监控资源的自动发现机制,资源的分层,分类,自组织的结构4. 可扩展,定制,可以用于对...
2011-08-17 20:52:10 315
原创 Spring-data-redis使用心得
上个星期用redis,protobuf实现了一个轻量级的mq。过程中尝试用了spring-data-redis,目前是1.0.0.2.M2-SNAPSHOT版本,貌似之前已经release了一个版本。 优点1.目前redis java客户端有多个:如jredis,jedis。用adapter的方式屏蔽了底层实现。让我们可以随意切换redis实现 2.将各种操作分类存放,不用在一...
2011-07-05 17:58:10 364
用utf-8编码的网站解决gbk编码的请求和应答的乱码问题
用utf-8编码的网站解决gbk编码请求和应答的乱码问题 一.目前现状server.xml<Connector URIEncoding="utf-8" connectionTimeout="200000" port="7080" protocol="HTTP/1.1" redirectPort="8443" useBodyEncodingForURI=..
2011-05-11 16:22:50 498
MongoDB查询时被锁住的问题
1. 背景mongoDB版本1.8.1 collection stats> db.user.gift.stats(){ "ns" : "statgame.user.gift", "count" : 650, "size" : 162804, "avg...
2011-04-25 14:00:56 4610
浏览器block新开窗口的问题
背景 用户填完提交表单,后台验证数据。验证通过,前端JS在页面加载时自动post并打开一个新的页面,新的页面时第三方支付平台的页面。验证出错,在当前页面显示错误提示。 #if(canPost) <script> $("#payForm").submit()</script>#end 问题每次post时都会被浏览器block,生...
2011-04-19 06:52:03 310
网站数据统计服务(一),架构
统计服务对业务数据进行迁移,分析。 外部迁移:业务数据存储于Mysql中,Mysql存储的数据会进行垂直,水平切分,业务数据会存在于多个mysql表中,数据分散使得分析程序写起来头大。并且mysql的单表存储量有限,扩展起来也不容易,要定期做数据迁移。于是我们将mysql中的数据定时地迁移到mongoDB中,并清理mysql中的数据。 外部迁移的程序是通用的:全量迁移,增...
2011-04-12 13:27:26 185
mongoDB简介
第1 页: MongoDB Coming第2 页:大纲大纲简介Why MongoMongo 特性Mongo 用法Mongo 架构MysqlMongoMongo javaJava DSL第3 页:简介简介MongoDB不是在实验室设计出来的。利用自己开发大型,高可用性和健壮性系统的经验,我们开发了MongoDB。我们并不...
2011-03-25 09:29:32 140
nginx反向代理后getRequestURL出现的问题
nginx:在nginx作了反向代理将pay.xxx.com映射到了hostname:80/pay location ^~ / { proxy_pass http://hostname:80/pay/; } tomcat: 在tomcat中获取requestURL打出来的是http://pay.xxx.com/pay/a/b.ht...
2011-03-18 12:32:48 2848
海量数据的删除策略
1.延迟删除一条数据会被很多数据引用。当被引用的数据删除时,引用的数据也需要删除。这时候可以用延迟删除的方法。例子:用户发表的帖子,可以被转发到很多地方。所有转发过的贴都是对原帖的引用,用户接着把他的原帖删除,所有被转发过的帖子也需要进行清理。我们采用的是延迟删除的方法,用户操作时,先直接删除原帖,被转发的贴,在点击时,会到原帖加载内容,这时发现原帖已经不存在,此时这条被点击的转发贴也...
2011-02-24 13:53:43 193
Mysql水平分表
Mysql在数据量大的情况下,会遇到水平分表的情况。1. 根据业务属性拆表这种分表方式的算法大致是取模,hash,md5等。用业务属性拆表,业务关系复杂的情况下,如果要根据其他条件查询,其他的条件都必须和这个属性关联起来,查询条件必须带有这个属性。例子:用户profile表根据用户ID取模进行水平拆分。社区里有群组,群组里有应用,应用有各种类型。可以用群组ID,应用ID拆表...
2011-02-22 10:26:19 184
Redis List
List: 它的数据结构和java中的linkedlist是一样的,是一个双向循环链表。在里面预先插入了3840000条记录。服务器配置,pc机,为Redis分配了1g内存 2g vm。1.插入:62ms,lpush rpush一样。2.删除:lpop,rpop 63ms。 删除第一个元素 lrem(key, value, 1) 63ms 删除最后一个元素 ...
2010-12-30 18:09:26 81
原创 抛弃TT/TC,拥抱Redis
1.我们需要复杂和灵活的数据结构如List,Set,而TT/TC table支持的是类似于简单的单表结构。我们先前是用TC Hash模拟出来的List,但在删除,分页,清理上都存在难度。维护起来也不方便。功能上Redis更适合我们的需求。 2.TT/TC java客户端比较弱,目前只能用memcached java client 3.Redis对并发操作提供了很多方便的API调用 4....
2010-11-05 16:09:05 157
蛋疼的PooledConnectionFactory(activemq-pool)
PooledConnectionFactory有两个属性maxConnections,maximumActive。咋一看来,用人类的常识理解,maxConnection应该表示最大可建的connection数,maximumActive应该表示最大活跃的connection数,当pool中的连接数大于最大活跃数时,又超过idleTimeout会被回收线程回收到。 如果是这样理解的,就...
2010-11-02 07:15:09 576
不用keytool,tomcat打开https
网上大多数文章都是用keytool生成自签名根证书,将根证书配置在tomcat的server.xml中。我不太喜欢用keytool,原因:1.我们可能换provider,不同的provider会有不同的算法实现,算法的安全性和性能也可能不同,通过代码生成比较方便一些,不同算法的实现要放在classpath上。2.通过代码生成还有一个好处,会对整个流程理解的比较清楚,实现的原理到底是怎样的。...
2010-08-14 01:04:20 151
原创 RDBMS的lucene爬虫
主要介绍如何周期性尽量实时地从RDBMS爬数据然后建索引,不涉及AOP或ORM Framework的listener方式。先决条件:Lucene索引是从无到有的,一开始所有数据都是存储在RDBMS(Oracle)中。 数据表有一列是updateTime或称为lastModifiedTime用来存储最后一次更新时间,并建有db索引 主表必须要有主键,这个主键也用来唯一确定一个L...
2010-05-07 10:28:16 100
在JavaMail的基础上构建自己的Email Channel(2):封装Javamail的原因
封装Javamail的原因两个字需求1. 去年已经写过一个Message channel,抽象出了消息发送的统一接口,已经支持FTP, JMS。底层还提出来了一套统一的connection pool结构。用户通过依赖注入方式配置选择通信方式,connection pool的策略,具体实现在代码中对用户都是透明的,用户可以方便地通过配置文件切换选择的通信方式。Email通信方式也需...
2010-05-07 10:25:55 153
在JavaMail的基础上构建自己的Email Channel(1):基础知识
在JavaMail的基础上构建自己的Email Channel基础知识Email入门不说太多,至于什么是Email,Email给我们带来什么好处,也就不唠叨了。但是先得看下Email的数据结构,因为我们需要根据领域逻辑,进行面向对象的设计。现在通过webmail和outlook发的邮件一般都是MIME邮件,如上图,但不同的client也可能稍微有所不同。邮件是由邮件头和邮件...
2010-05-07 10:24:13 335
原创 OC4J升级Oracle JDBC driver版本
OC4J升级Oracle JDBC driver版本DB升级到11g,application server是10133,必须升级OJDBC driver版本 备份$OC4J_HOME/j2ee/home/config下的system-application.xml和server.xml在$OC4J_HOME/j2ee/home/shared-lib下新建目录oracle.jdbc...
2010-01-15 16:53:44 391
原创 2009年工作总结
CUSTOMER FOCUS Be patient to listen to application users to speak out their requirements. Try best to satisfy all the reasonable requirements put forward by them. Suppose and analyze their potential r...
2010-01-06 15:48:08 70
Prentice Hall - Effective Java 2nd.Edition May 2008
2008-06-19
Apress.Pro.C.Sharp.2008.and.the.dot.NET.3.5.Platform.4th.Edition.Nov.2007.part2
2008-06-19
Systems.Engineering.with.SysML.UML.Feb.2008.eBook-BBL.pdf
2008-06-19
Apress.Facelets.Essentials.May.2008
2008-06-18
Prentice Hall - Effective Java 2nd.Edition May 2008
2008-06-18
McGraw.Hill.Oracle.Database.11g.PL.SQL.Programming.Mar.2008
2008-06-02
Wrox.Professional.Ruby.on.Rails.Feb.2008
2008-06-02
Wiley.Pattern.Oriented.Software.Architecture.Volume.5
2008-05-19
SOA Approach to Integration
2008-05-11
Google Guice Agile Lightweight Dependency Injection Framework
2008-05-11
From Project to Product Turning Your Code into a Saleable Product.pdf
2008-05-07
Apress.Beginning.SQL.Queries.From.Novice.to.Professional.Apr.2008.pdf
2008-05-07
Wrox.XML.Problem.Design.Solution.Jun.2006
2008-04-06
Packt.Publishing.Service.Oriented.Java.Business.Integration.Feb.2008
2008-04-06
LINQ Pocket Reference
2008-03-26
Pragmatic Version Control Using Subversion, 2nd Edition
2008-03-09
Java Language Specification, 3rd Edition (2005).
2008-03-04
Base64编码不要用在URL中
2011-05-12
java变量作用域完了是不是就可以垃圾回收
2008-06-26
TA创建的收藏夹 TA关注的收藏夹
TA关注的人