Month: October 2011

常见性能测试指标

常见性能测试指标   1.Avg Rps和90% Rps   2.TPS, RPS   3.Error发生率   4.Throughput每秒   5.服务器负载:CPU,MEM,IO,NET 可以重点说下Linux服务器的CPU指标(从某次培训中听来的) 1.CPU的时间分解   a.用户态占比    b.内核态占比   c.io请求等待时间   d.cpu空闲占比 2.其它CPU指标   a.cpu load (线程队列长度)   b.上下文切换 (I/O容易产生上下文切换,这是因为I/O时容易产生等待,一等待就会CPU就会被其它进程抢占,产生上下文切换)

VIP

转自WIKIPEDIA virtual IP address (VIP or VIPA) is an IP address that is not connected to a specific computer or network interface card (NIC) on a computer. Incoming packets are sent to the VIP address, but they are redirected to physical network interfaces. VIPs are mostly used for connection redundancy; a VIP address may still …

VIP Read More »

PreparedStatement: SQL的in字句后面的候选值的个数不定怎么办?

对这样一条SQL:    sql * from t where c in (?,? …?) 我们希望问号的个数是固定的,这样才能利用SQL预编译缓存,避免硬解析 但如果问号个数就是不固定的怎么办?     1.如果问号的最大个数是固定的,则总是使用最大个数的问号;当parameter数小于问号数时,用null补全     2.如果连最大个数都不是固定的,则要考虑使用数组类型了

框架设计的核心原则之一:indirection

有句话叫做: "All problems in computer science can be solved by another level of indirection" 最近学习了一些框架,很多地方都暗合了这句话。我把我能理解的外延列举一下:   1. 通过indirection避免diretion所需的复杂性。比如通过操作系统访问硬件比直接机器码操作硬件要简单的多。   2. 通过抽象的indirection,达到具体实现的多样性以及可插拔性。比如一个DAO可以用hibernate实现,也可以用ibatis实现,上层不必关心。 “抽象化”不限于OO领域,任何有共性的东西都可以抽象成同一种东西,比如,URL/文件路径都可以抽象成“资源”;JVM也是一个著名的例子。   3. 你表面上在使用一种东西,但在背地里,你的框架却偷偷地通过indirection思想,通过另一种东西来为你服务。这就是“ 虚拟化”,它的好处是可以让你用你熟悉的方式去使用服务。举些例子:       a.你以为你的程序跑在一台普通电脑上,实际上那不过是个VMWare而已       b.看上去你写的SQL都基于单个数据库,实际上你的DB早就被分库、分表的面目全非了,只不过你的架构师自写了一套jdbc driver,屏蔽了这些复杂性而已。

热部署插件JRebel及其替代品

JRebel可以让你在修改代码后马上看到它的效果,而不需要重启整个应用。 但它不是免费的。所以你会问有没有同类的免费的东西,有人回答说: I’m one of the JRebel developers and I can assure you that no open source alternatives exist at the moment (you’re free to take this with a grain of salt). http://stackoverflow.com/questions/1566534/open-source-alternative-to-javarebel 不过,据说这个凑和:  http://ssw.jku.at/dcevm/ p.s. rebel出了免费社区版了:  http://zeroturnaround.com/blog/free-version-of-jrebel-social/

java程序的默认Locale如何决定

The default locale of your application is determined in three ways. First, unless you have explicitly changed the default, the getDefault() method returns the locale that was initially determined by the Java Virtual Machine (JVM) when it first loaded. That is, the JVM determines the default locale from the host environment. The host environment’s locale …

java程序的默认Locale如何决定 Read More »

《软件架构设计》读书笔记 – 3. 典型的差的软件架构

《软件架构设计》温昱著 差的软件架构的常见的毛病:   1.急着设计,导致遗漏了一些非功能需求   2.着急,可扩展性没做好   3.多视图中只考虑了部分视图。比如用户感觉好,但开发人员和SCM被搞的很痛苦   4.未经初步验证就投入使用,到后期才发现架构不可行。其实应该在图画好之后作个垂直原型来验证一下