Monthly Archives: February 2017

Performance Test

When talking about the performance of a web service, it is intended to think about 2 metrics. 1. TPS 2. Latency 3. TP50, TP90, TP99 etc.

  1. single thread test for base line.
    One thread tests for a period of time. This tests the ideal response latency.
  2. Find the peak TPS
    Test the web service TPS by increasing number of connections. TPS should go up as connections increases, then reach the peak, then goes down.
  3. Test the TP50, TP90, TP99 etc
    Around the peak TPS thread connection, monitor the avg latency, TP50, TP90, TP99 etc. Find the number of connection where you can accept the latency metrics.


SSL/TLS are the protocols that aim to provide privacy and data integrity between two parties.
HTTPS is HTTP protocols over SSL or TLS protocols. It requires the SSL/TLS establish first, then HTTP is exchanged over SSL/TLS protocols.
In TLS, Certificate contains the public key that server sends out. Publish key will be used to encrypt the symmetric key later.
In the end, client and server communicates through the symmetric key.


Lambda Generic

This is a piece of code to use lambda to implement the generic type interface.

public class LambdaGeneric {

    public static void main(String[] args) {

    public static void test1() {
        A a = () -> {};

        B b = (b1, b2) -> {};
        b.apply("hello", 1);
        //        b.apply(2, 1);    won't pass because the type is wrong.

        C c = (c1, c2) -> {
        c.apply(1, "hello");

    public interface A {
        public void apply();

    public interface B {
        public void apply(String a, Integer e);

    public interface C<T, V> {
        public void apply(T t, V v);