liuqingyu/fqueue

关于mappedByteBuffer.force();的问题

GoogleCodeExporter opened this issue · 0 comments

直接拿项目介绍里的代码跑了一下  WINDOWS系统 设了1G内存 
写1024字节  
发现LogEntity里调用mappedByteBuffer.force();操作,有时候巨卡,多�
��时候达到1分多钟 求解
public static void main(String[] args) throws Exception {
        FQueue fQueue = new FQueue("/home/q/db/");
        StringBuilder sb = new StringBuilder();
        int length = Integer.parseInt(args[0]);
        for (int i = 0; i < length; i++) {
            sb.append("a");
        }
        byte[] data = sb.toString().getBytes();
        fQueue.add(data);// 预热一下
        long start = System.currentTimeMillis();
        for (int i = 0; i < 100000000; i++) {
            fQueue.add(data);
        }
        System.out.println(100000000.0 / ((System.currentTimeMillis() - start) / 1000) + "qps");
        fQueue.close();
    }


Original issue reported on code.google.com by sunrong...@gmail.com on 20 Jan 2015 at 8:56