1. 一个金融系统考虑到的

    为了安全起见,所有的写操作都要计入Audit表中 考虑效率(reconciliation&settlement),引入影子表(这是一个实表,非虚表). 影子表是对多个业务相关表的数据冗余。 数据库表设计时留了一些字段,并不表示任何业务意义,仅仅是为了以后扩充。虽丑陋但实用,能解决部分问题。 表结构设计时不设主键外键,提高性能? Portal支持SSL 逻辑删除表记录,如结算,对账中用到的帐号信息。 7. 虽然是BS结构的网站,从网络层面配置可访问的IP地址--白名单。 8. 系统自己定义一些业务规则并在payment流程中验证这些规则。 现在很多网上支付系统加入了短信验证码的机制

    2017/02/12 iteye

  2. 4+1架构

    为了从不同stake holder的角度来看架构,架构设计文档从多个角度来说明   Logical View 关注 FS Process View 关注 Non-FS Implementation View 关注组件,层次实现及具体关系 Data View 关注数据持久化   中心是 Use Case View 描述关键业务流程

    2017/02/12 iteye

  3. 事务之CAP/BASE

    CAP理论: Consistency Availability Tolerance of  network partition 一般来说,分区容忍性( partition Tolerance )是网站可伸缩性必需的,因此只能在Consistency和Availability之间做出取舍。   Base: Basically Available Soft state Eventually Consistent.

    2017/02/12 iteye

  4. Java GC 策略

    Sun Hotspot JVM的GC策略是分代: Yong Generation: Eden, Survior1, Survivor2  Scavenge GC, Copy算法,GC频繁   Old(Tenured) Generation  会引起Full GC, 尽可能减少Full GC次数.一般采用CMS(Concurrency-Mark-Sweep, C is not referening to Compact)算法   Permanent Generation     会引起Full GC, 尽可能减少Full GC次数     通过 -XX:PermSize= -XX:MaxPermSize=  设置    permanent Generation Space 保存Class,Method等MetaData信息,与Heap不同,Sun JVM默认64M。   注: GC调优中平衡throughput和pause time两个指标, Server 和 Client JVM会有不同的考量(HotSpot中) new,old space 调优 new space一般占25~40%,如果Stateless对象比较多的话可以考虑多分配一点;相反如果stateful对象比较多,可以多分配一点old space     java 启动命令行中加入 -verbose:gc 来measure 当前GC 性能     [GC 325407K->83000K(776768K), 0.2300771 secs] [GC 325816K->83372K(776768K), 0.2454258 secs] [Full GC 267628K->83769K(776768K), 1.8479984 secs]     325407K和83000K是Minor GC前后Yong GenerationHeap大小   776768K  is the committed size of the heap: the amount of space usable for java objects without requesting more memory from the operating system. Note that this number does not include one of the survivor spaces, since only one can be used at any given time, and also does not include the permanent generation, which holds metadata used by the virtual machine. 我的理解是young 和old generation当前之和除去一个survivor区和permanent区的大小。当前young Generation的大小是逐步增大的,介于xms和xmx之间。   -XX:+PrintGCDetails 参数输出的GC log格式会有不同     [GC [DefNew: 64575K->959K(64576K), 0.0457646 secs] 196016K->133633K(261184K), 0.0459067 secs]   indicates that the minor collection recovered about 98% of the young generation, DefNew: 64575K->959K(64576K) and took 0.0457646 secs (about 45 milliseconds).   The usage of the entire heap was reduced to about 51% 196016K->133633K(261184K) and that there was some slight additional overhead for the collection (over and above the collection of the young generation) as indicated by the final time of 0.0459067 secs.     -XX:NewRatio=3 means that the ratio between the young and tenured generation is 1:3. In other words, the combined size of the eden and survivor spaces will be one fourth of the total heap size.   6. -XX:SurvivorRatio=6   sets the ratio between a survivor space and eden  to 1:6. In other words, each survivor space will be one sixth the size of eden, and thus one eighth the size of the young generation (not one seventh, because there are two survivor spaces).

    2017/02/12 iteye

  5. use case in Functional Specification

    一种可行的描述use case的方法是: 列表显示Normal Flow:如1,2,etc   列表显示Alternative Flow,注意需要对应(借助)与Normal Flow.并且前面加一个前缀A.以区别。比如Normal Flow的Step 2有Alternative Flow的话,称为A.2.1, A.2.2直至该Flow结束   列表显示Exception Flow,注意需要对应(借助)与Normal Flow和Alternative Flow.并且前面加一个前缀E.以区别。比如E1.1, E.A.2.1.1,etc.   其他可选的包括 data requirement ( 页面字段描述,包括是否mandatory ) 和 Error Message描述。

    2017/02/12 iteye

  6. 我眼中的LLD

    LLD一般与Functional Specification 和 HLD对应。包括: Purpose,  Intended/Target Audience   Data Model 必要的UML图 Logging处理 Exception 处理 Security处理 Transaction处理 Assumption Dependencies/Third Party Jar External Interfaces Limitation

    2017/02/12 iteye

  7. 多线程同步

    synchronized语句     同步的代码块尽量少     locks split, 私有的对象锁代替this   volatile for double, long primitive type.   ThreadLocal   使用 JDK1.5提供的锁  java.util.concurrent.locks.Lock,  java.util.concurrent.locks.ReadWriteLock  

    2017/02/12 iteye

  8. java中的动态代理

    jdk中动态代理只支持接口的方式   实现方式是:   调用 java.lang.reflect.Proxy中的静态方法     newProxyInstance(ClassLoader loader,                                       Class[] interfaces,                                       InvocationHandler h) loader和interfaces是被代理类的   针对返回的对象转型为被代理类的接口   2. 实现一个java.lang.reflect.InvocationHandler 接口,实现其中的方法   >public Object invoke(Object proxy,                      Method method, Object[] args) 此处关键是需要传入具体类作为此实现类的实例变量,  并保证以以下方式调用,并在该方法调用前后加入需要代理的逻辑   >method.invoke(被代理类实例,args);  

    2017/02/12 iteye