- 博客(155)
- 资源 (38)
- 收藏
- 关注
转载 [zz】分布式系统的raft算法
原帖地址:https://www.jdon.com/artichect/raft.html 分布式系统的Raft算法 过去, Paxos一直是分布式协议的标准,但是Paxos难于理解,更难以实现,Google的分布式锁系统Chubby作为Paxos实现曾经遭遇到很多坑。 来自Stanford的新的分布式协议研究称为Raft,它是一个为真实世界应用建立的协议,主要注重协议的落地性...
2018-09-21 16:12:12 410 1
转载 【zz】Recv-Q&Send-Q
原帖地址:https://blog.csdn.net/acmer1183/article/details/52014216 最近线上某些服务器老是报cpu load高,同机房其他机器却没有问题。排查发现以下异常ss -nlRecv-Q Send-Q Local Address:Port Peer Addr...
2018-09-18 11:05:27 434
转载 【zz】dpdk全面分析
文章转载自https://www.cnblogs.com/bakari/p/8404650.htmlPS:欢迎大家关注我的公众号:aCloudDeveloper,专注技术分享,努力打造干货分享平台,二维码在文末可以扫,谢谢大家。高性能网络技术随着云计算产业的异军突起,网络技术的不断创新,越来越多的网络设备基础架构逐步向基于通用处理器平台的架构方向融合,从传统的物理网络到虚拟网络,从...
2018-09-10 08:55:32 5546
原创 brpc:countdown event acquire release
acquire 是要求下面的语句不能优化后跑到上面来;release是要求上面的语句优化后,不能跑到下面去; // bthread - A M:N threading library to make applications more concurrent.// Copyright (c) 2016 Baidu, Inc.// // Licensed under the A...
2018-09-07 11:15:25 542
转载 [zz]Acquire and Release Semantics
http://preshing.com/20120913/acquire-and-release-semantics/Acquire and Release SemanticsGenerally speaking, in lock-free programming, there are two ways in which threads can manipulate shared memo...
2018-08-13 18:53:32 234
转载 [zz]The Synchronizes-With Relation
from:http://preshing.com/20130823/the-synchronizes-with-relation/ The Synchronizes-With RelationIn an earlier post, I explained how atomic operations let you manipulate shared variables con...
2018-08-13 18:52:51 439
转载 【zz】浅析C++多线程内存模型
原地址:http://www.parallellabs.com/2011/08/27/c-plus-plus-memory-model/ 浅析C++多线程内存模型注:本文发表于《程序员》2011年第6期并行编程专栏,略有删改。在即将到来的C++1x标准中,一个重大的更新就是引入了C++多线程内存模型。本文的主要目的在于介绍C++多线程内存模型涉及到的一些原理和概念,以帮助...
2018-08-13 18:17:09 790
转载 log2ceiling and log2floor from brpc bits.h
// Copyright (c) 2009 The Chromium Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.// This file defines some bit ...
2018-08-08 16:42:51 332
转载 【zz】借助backtrace和demangle实现异常类Exception
转载自:http://www.codeweblog.com/%E5%80%9F%E5%8A%A9backtrace%E5%92%8Cdemangle%E5%AE%9E%E7%8E%B0%E5%BC%82%E5%B8%B8%E7%B1%BBexception/ C++的异常类是没有栈痕迹的,如果需要获取栈痕迹,需要使用以下函数:#include <execinfo.h>...
2018-08-08 16:30:29 237
原创 brpc DoublyBufferedData
ScopedPtr 析构时自动释放,本线程的锁。 保存一个wrapper到本地线程的私有变量里,析构时删除。双缓冲,空间换时间,一个用来读,一个用来写,写完后切换一下。_index 保存了读取的对象的下标。bg_index为写的对象的下标。分别为0和1,所以bg_index=!_indexWrapper 每个读线程一个。读取时,从线程本地变量中读取,如果有,则直接获取。如果没有...
2018-08-07 09:31:29 1506
原创 rdkafka 使用案例
main.cpp#include <iostream>#include <ctype.h>#include <signal.h>#include <string.h>#include <unistd.h>#include <stdlib.h>#include <syslog.h>#include
2018-07-30 13:46:41 3237 1
原创 gzip 压缩解压代码示例
#include <zlib.h>#include <iostream>#include <stdint.h>#include <string.h>#include <stdlib.h>using namespace std;#define RD_GZ_CHUNK 262144#define RD_ZERO_INIT...
2018-07-25 11:45:46 1233
转载 Linux Dynamic Shared Library && LD Linker
原帖地址: https://www.cnblogs.com/LittleHann/p/4244863.htmlLinux Dynamic Shared Library && LD Linker目录1. 动态链接的意义2. 地址无关代码: PIC3. 延迟版定(PLT Procedure Linkage Table)4. 动态链接相关结构5. 动态链接的步骤和实现6. Li...
2018-07-10 08:29:06 535
转载 [zz]美团点评智能支付核心交易系统的可用性实践
原文地址: https://www.cnblogs.com/xiexj/p/8886356.html 背景每个系统都有它最核心的指标。比如在收单领域:进件系统第一重要的是保证入件准确,第二重要的是保证上单效率。清结算系统第一重要的是保证准确打款,第二重要的是保证及时打款。我们负责的系统是美团点评智能支付的核心链路,承担着智能支付100%的流量,内部习惯称为核心交易。因为涉及美团点评所有线下交易商家...
2018-06-08 12:19:03 367
转载 [zz]一组延时数据
原文网址: http://blog.jqian.net/post/latency-trends.html一组延时数据Jan 11, 20132010年Jeff Dean在一次演讲中给出了一份所有程序员都应该了解的数据。不过这组数据其实有些过时了,Colin Scott这位有心人重新整理了一份数据,并且还是随时间变化的,对比起来看非常有意思。更新今年的数据如下:L1 cache reference ...
2018-05-16 12:05:15 186
转载 【zz】 服务器编程中的文件描述符
http://www.cnblogs.com/gaorong/p/6977814.htmllinux系统下一切皆文件,通过虚拟文件系统(VFS)的机制将所有底层屏蔽掉,用户可以通过统一的接口来实现对不同驱动的操作,对于每一个文件需要一个引用来指示,此时文件描述符应用而生,文件描述符类似于widows下的handle,对于文件的大部分操作都是通过这个描述符来操作的,例如read,write。对于每一...
2018-05-16 11:44:44 157
转载 [zz]epoll全面讲解:从实现到应用
多路复用的适用场合• 当客户处理多个描述符时(例如同时处理交互式输入和网络套接口) • 如果一个TCP服务器既要处理监听套接口,又要处理已连接套接口 • 如果一个服务器即要处理TCP,又要处理UDP • 如果一个服务器要处理多个服务或多个协议 select/poll/epoll差别poll返回的时候用户态需要轮询判断每个描述符的状态,即使只有一个描述符就绪,也要遍历...
2018-05-16 11:34:57 359
转载 printf输出%f %lld问题。输出类型和数据类型不匹配会发生什么?
原帖:http://blog.csdn.net/u011497904/article/details/42454483——总结自《C PRIMER PLUS》直接看三个例子:[cpp] view plain copyint a=4; printf("%f %e\n",a,
2018-01-29 09:14:07 1119
转载 Double-Checked Locking is Fixed In C++11
http://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/Double-Checked Locking is Fixed In C++11The double-checked locking pattern (DCLP) is a bit of a notorious case stu
2017-12-11 16:57:20 238
转载 The "Double-Checked Locking is Broken" Declaration Signed by: David Bacon (IBM Research) Joshua Blo
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.htmlThe "Double-Checked Locking is Broken" DeclarationSigned by: David Bacon (IBM Research) Joshua Bloch (Javasoft), Jeff Bo
2017-12-11 16:55:17 273
转载 6.1 原子操作
http://www.epubit.com.cn/book/onlinechapter/55636.1 原子操作深入解析Android 5.0系统6.1 原子操作对简单类型的全局变量进行操作时,即使是一些简单的操作,如加法、减法等,在汇编级别上也需要多条指令才能完成。整个操作的完成需要先读取内存中的值,在CPU中计算,然后再写回内存中。如果中间发
2017-12-11 16:08:29 756
转载 内存屏障什么的
内存屏障什么的On October 28, 2010, in C语言, linux, linux系统, 系统结构, by sponge当你看到“内存屏障”四个字的时候,你的第一反应是什么?寄存器里取出了错误的值?ifence,sfence之类的指令?还是诸如volatile之类的关键字?好吧,我第一次看到这四个字的时候,脑子里浮现出的是魔兽争霸里绿油
2017-12-11 16:04:25 275
转载 浅谈Memory Reordering
原文:http://dreamrunner.org/blog/2014/06/28/qian-tan-memory-reordering/ Memory ordering在我们编写的 C/C++代码和它被在 CPU 上运行,按照一些规则,代码的内存交互会被乱序.内存乱序同时由编译器(编译时候)和处理器(运行时)造成,都为了使代码运行的更快.被编译开发者和处理
2017-12-11 11:06:22 497
原创 BinaryAnalyzer
#pragma once#include ".\NetCommuication\commuanalyzer.h"class CSzBinaryAnalyzer : public CCommuAnalyzer{public: CSzBinaryAnalyzer(void); ~CSzBinaryAnalyzer(void); /*
2017-11-21 08:35:49 242
原创 xsdk
#if !defined(__XSDK_H__)#define __XSDK_H__//------------------------------------------------------------------------------#ifndef XSDK_OK#define XSDK_OK 0#endif#ifn
2017-11-21 08:31:40 1145
原创 BinaryRecorder
// BinaryRecorder.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "BinaryApplication.h"#include #include using namespace std;void wait(){std::cout while ( true ){
2017-11-21 08:30:25 225
原创 BinaryApplication
#pragma once#include "CMyCriticalSection.h"#include "CCriticalSectionGuard.h"#include "FileLog.h"#include "./CustBinaryBizClass.h"#include "./NetCommuication/CommuApplica
2017-11-21 08:29:59 357
原创 AsyncLogger
#ifndef ASYNC_LOGGER_H#define ASYNC_LOGGER_H#include #include "CMyCriticalSection.h"#include "LogBlock.h"#include "ChangeBinaryAndJson.h"#include "FileLog.h"class AsyncLogger
2017-11-21 08:29:02 1223
原创 rapidjson
// Tencent is pleased to support the open source community by making RapidJSON available.// // Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.//// Lic
2017-11-21 08:28:12 687
原创 NetComm-TCPConnect
#pragma once#include #include #include "CommonDefine.h"#include "CommuAnalyzer.h"#include "CommuApplication.h"#include "CCriticalSectionGuard.h"class CTCPConnect{public: C
2017-11-21 08:27:19 428
原创 NetComm-TCPServer
#pragma once#include #include #include "tcpconnect.h"class CTCPServer : public CTCPConnect{public: CTCPServer(void); ~CTCPServer(void); friend unsigned __stdcall StartS
2017-11-21 08:26:25 352
原创 NetComm-CommuApp
#pragma once#include "CommonDefine.h"class CCommuApplication{public: CCommuApplication(void); virtual ~CCommuApplication(void); /* * Desc: * 回调返回接收到的完整网络报文 * Pra
2017-11-21 08:25:42 284
原创 NetComm-CommDefine
#pragma once#include namespace TCPCONNECT{ enum BLOCKING_MODE { MODE_BLOCKING = 0, MODE_UNBLOCKING = 1 }; enum COMMUNICATION_MODE { MODE_SERVER = 1,
2017-11-21 08:24:32 405
原创 snapshot
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file. See the AUTHORS file for names o
2017-10-30 13:49:27 239
原创 hqtest
#include "stdafx.h"#include "net_func.h"#include "request.h"#include #include vector> typedef unsigned int (_stdcall THREAD_START_ROUTINE)(void *); bool thread_spawn( THREAD_START_ROUTINE func
2017-10-27 16:00:14 466
原创 response
#ifndef _RESPONSE_H#define _RESPONSE_H #include set>#include map> #include "stock.h"#include "BidQuoteObserver.h" using namespace std; typedef setstring> StringSet;typedef map int, Strin
2017-10-27 15:59:49 337
原创 request
#ifndef _STOCK_REQUEST_H_#define _STOCK_REQUEST_H_ #include deque> #include "config.h"#include "stock.h"#include "NBSocket.h" using namespace std; #pragma pack(push)#pragma pack(1) class
2017-10-27 15:59:13 416
原创 net_func
#include #include #pragma once struct HQServerInfo{ char szServer[32]; short iPort; int iCmdId;}; BOOL WinSockInit(); unsigned int __stdcall GetHQAvgCost( void * pInfo ); unsi
2017-10-27 15:58:39 313
原创 NBSocket
#ifndef _NBSOCKET_H_#define _NBSOCKET_H_ #include#includestring>#include"Channel.h" class NBSocket{public: NBSocket(); ~NBSocket(); int Connect( const char * sIP, short iPort, struct tim
2017-10-27 15:57:57 195
原创 config
#ifndef _STOCK_CONFIG_H_#define _STOCK_CONFIG_H_ typedef unsigned long ulong;typedef unsigned int uint;typedef unsigned short ushort;typedef unsigned char uchar; #endif #ifndef
2017-10-27 15:56:15 419
reliable rabbitmq c++ client
2018-07-16
trade middle ware
2018-06-29
simple exchange platform client
2018-06-01
evpp based echo server
2018-05-03
libevent echo server
2018-04-24
thrift with memfunc and uid generator
2018-01-30
thrift server support db operation and rest protocol
2018-01-18
20180111 ieap
2018-01-11
AnalyzeServer 20180109 with DBConnPool
2018-01-09
thrift example
2018-01-04
prpc_20181109
2018-11-09
coroutine using phxrpc
2018-11-01
remote procedure call using protobuffer
2018-08-21
brpc doubly_buffered_data test
2018-08-07
rabbitmq-c client publish get example
2018-07-13
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人