免費的跨平臺SSH和SFTP工具:
https://www.putty.org/ -- Windows
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
https://www.poderosa-terminal.com/ -- Windows/Mac
https://filezilla-project.org/ -- Windows/Mac/Linux -- https://download.filezilla-project.org/client/
英文 https://filezilla-project.org/ 中文 https://www.filezilla.cn/
Mac下使用自帶終端SSH功能 -- 自帶的SFTP是文本輸入型的,沒有圖形界面
Windows SSH推薦使用XShell或者putty -- https://www.portablesoft.org/xshell-legacy-versions/
Mac SSH推薦使用自帶的終端命令
http://firecats-MacBook-Pro:~$ ssh [email protected]
Windows/Mac SFTP推薦使用FileZilla,CentOS 7終端命令行方式安裝FileZilla
Github桌面版工具,GitHubDesktop:
https://desktop.github.com/ -- 支持Windows 64bit和Mac系統
https://help.github.com/desktop/guides/ 幫助文檔
Wireshark
https://www.wireshark.org/download/win64/
https://accfcx.github.io/post/tools/
socket:中國大陸翻譯爲套接字,臺灣翻譯爲插座。感覺插座更容易理解。
https://blog.csdn.net/alitech2017 阿里技術官方號
https://www.taohui.pub/ -- 陶輝,《深入理解Nginx:模塊開發與架構解析(第2版)》作者
https://blog.csdn.net/russell_tao -- 陶輝,《深入理解Nginx:模塊開發與架構解析(第2版)》作者
https://blog.csdn.net/nsrainbow --- 楊曦,《HBase不睡覺書》作者
http://zhuanlan.51cto.com/columnlist/shenj/ --- 58沈劍
http://blog.csdn.net/analogous_love --- 范蠡&張小方
https://www.cnblogs.com/balloonwj/ --- 范蠡&張小方
https://github.com/baloonwj/flamingo --- 范蠡&張小方
http://blog.csdn.net/column/details/15700.html --- teamtalk
https://github.com/forhappy/Cplusplus-Concurrency-In-Practice --- 《C++ 併發編程指南》
epoll定時器實現系列文章:高性能定時器實現的三種方式---升序鏈表,時間輪,最小堆
TCP面試常見題:張小方的知乎Live:輕鬆搞定技術面試中常見的網絡通信問題
去BAT,你應該要看一看的面試經驗總結 【面試三部曲1,推薦】
面試成功必備,C++ 後臺開發面試時一般考察什麼?【面試三部曲2,推薦】
Linux服務器百度面試【面試三部曲3,推薦】
《Linux多線程服務端編程:使用muduo C++網絡庫》學習筆記 【firecat整理,推薦】
我個人的Linux TCP Server和client測試源碼,C語言(1)(★firecat推薦★)
我個人的Linux TCP server和client測試源碼,C語言(2)(★firecat推薦★)
C/C++語言版本的http server和client,請關注
http://blog.csdn.net/libaineu2004/article/details/78490165
C++11 future
https://github.com/facebook/folly -- Facebook開源C++庫 --- Folly: Facebook Open-source Library
https://github.com/facebook/folly/tree/master/folly/futures
詳談C++11新特性之future及開源項目ananas(folly,std c++11和ananas的future各自的區別是?) -- ananas, Qedis
https://github.com/TarsCloud/Tars -- 重量級rpc
https://github.com/TarsCloud/TarsDocker -- docker,由於管理平臺和基礎服務安裝配置太複雜,所以搞了個鏡像
https://github.com/TarsCloud/TarsCpp
https://github.com/TarsCloud/TarsGo
https://github.com/Tencent/TSeer
https://github.com/Tencent/phxrpc -- 輕量級rpc
https://github.com/Tencent/mars -- weChat
https://github.com/Tencent/rapidjson -- rapidjson
http://rapidjson.org/zh-cn/index.html
muduo
muduo是一個高質量的Reactor網絡庫,採用one loop per thread + thread pool架構實現,代碼簡潔,邏輯清晰,是學習網絡編程的很好的典範。
http://blog.csdn.net/solstice --- muduo blog
https://github.com/chenshuo/muduo --- muduo官方boost版本
https://github.com/chenshuo/muduo/tree/cpp11 --- muduo官方C++11版本
https://github.com/chenshuo/muduo/tree/cpp98 --- muduo官方C++98版本
多線程服務器的常用編程模型 --- oneloop per thread + threadpool
http://blog.csdn.net/KangRoger/article/category/5679833 muduo源碼學習
http://www.cnblogs.com/peimin/category/548834.html muduo源碼學習
使用C++11改造muduo -- https://github.com/AlexStocks/muduo
發佈一個改寫自muduo的C++網絡I/O庫 -- https://github.com/kimg-bo/kimgbo
開源網絡庫的分析libevent muduo nginx ...
C++仿造muduo實現的多線程網絡庫,github檢索關鍵詞"C++11 network"
https://github.com/loveyacper/ananas -- C++11寫的網絡庫和rpc
https://github.com/guangqianpeng/tinyev -- C++17寫的網絡庫
https://github.com/guangqianpeng/jrpc -- C++17寫的rpc
https://github.com/IronsDu/brynet -- C++11寫的網絡庫
https://github.com/IronsDu/gayrpc -- C++14/17寫的rpc
https://github.com/yedf/handy -- C++11寫的網絡庫
https://github.com/xiongziliang/ZLToolKit -- C++11寫的網絡庫,支持windows
https://github.com/xiongziliang/ZLMediaKit -- A lightweight RTSP, RTMP, WebSocket, HTTP server and client framework based on C++11
https://github.com/cpp-taskflow/cpp-taskflow -- Modern C++ Parallel Task Programming Library
HP-Socket
HP-Socket是一套通用的高性能 TCP/UDP/HTTP 通信框架,包含服務端組件、客戶端組件和Agent組件,廣泛適用於各種不同應用場景的 TCP/UDP/HTTP 通信系統,提供 C/C++、C#、Delphi、E(易語言)、Java、Python 等編程語言接口
https://github.com/ldcsaa/HP-Socket
https://gitee.com/ldcsaa/HP-Socket
https://www.oschina.net/p/hp-socket
https://www.cnblogs.com/ldcsaa
ACL
愛奇藝,鄭樹新,One advanced C/C++ library
https://github.com/acl-dev/acl
https://github.com/acl-dev/libfiber
https://github.com/freeeyes/PSS
熊萬平,網絡io框架
https://github.com/xwpcom/CoreLooper
cpp-netlib
360 evpp
https://github.com/Qihoo360/evpp
https://github.com/Qihoo360/pika
libuv
https://github.com/libuv/libuv -- 源碼,cmake
https://nikhilm.github.io/uvbook/index.html -- 文檔
http://docs.libuv.org/en/v1.x/api.html -- api
http://docs.libuv.org/en/v1.x/guide.html -- user guide
https://github.com/nodejs/http-parser -- http,可以和libuv結合起來使用
https://github.com/libevent/libevent -- 競爭者
ec是基於libevet的C++11封裝
https://git.oschina.net/havesnag/ec
mysql連接池
數據庫連接池c++ (msyql) mysql connector c++ 的使用
基於Mysql Connector(C++)的數據庫連接池的實現
https://github.com/zsummer/zsummerX
https://github.com/zsummer/log4z
https://github.com/cameron314/concurrentqueue
kcp https://github.com/skywind3000/kcp
kcp是一種可靠udp,是一套純算法的來保證udp包有序、不丟失。那麼問題來了,這說的不就是tcp嗎?爲啥還要可靠udp這個東西,原因在於有很多場景對網絡延遲要求非常高,遊戲中的實時對戰就是這樣的場景,如果直接使用tcp延遲太高會很卡,如果直接使用udp會丟包,無序。kcp和tcp都會保證可靠,但問題時kcp爲何在保證可靠的情況下比tcp快。tcp時很多年前設計的,在低延遲的場景下tcp並不能很好的勝任,kcp改進了tcp的不足:RTO翻倍vs不翻倍、快速重傳、延遲ACK vs 非延遲ACK、選擇性重傳 vs 全部重傳。換句話說,tcp的實現並編譯進了操作系統,而kcp是一套算法,基於udp傳輸,可以靈活的調整一些參數來提高傳輸速度,降低延遲。
------
在學習muduo網絡庫前,應該先熟悉一下多線程網絡服務編程模型。在6.6.2節介紹了11種方案。方案0到方案4用的是阻塞I/O。方案5到方案11用的都是非阻塞I/O。
方案0: accept+read/write
方案0不是併發模型,只是一個循環處理。用代碼表示的話,可以表示爲:
while(true)
{
int fd=accept(……);
read(fd,……) or write(fd……);
close(fd);
}
一次只能處理一個連接,第一個連接處理完畢後,纔可以進入下一次循環,否則阻塞在I/O的read或write上。
方案1 accept+fork
這是個併發模型,這個模型比較簡單,在accept後,fork一個子進程,在子進程處理連接。可以表示爲:
while(true)
{
int fd=accept(linstenFd,……);
int pid=fork();
if(pid==0)//child
{
close(listenFd);
read/write(fd……);
close(fd);
}
//Parent
close(fd);
}
這個模型中要注意的是,要在子進程關閉監聽的fd,在父進程關閉到來連接的fd。
方案2 accept+thread
這個方案和方案1類似,只是這個方案中是通過新建了線程來處理連接,方案1是通過新建線程來處理連接。
void ProcessIO(void* arg)
{
int fd=*static_cast<int *>arg;
read/wire(fd,……);
close(fd);
}
void ProcessAccept()
{
while(true)
{
int fd=accept(……);
pthread_create(……, NULL, ProcessIO, &fd);
}
}
}
先調用ProcessAccept等待連接,如果有連接,則創建新線程來調用ProcessIO,把新建連接的fd傳給這個函數。
方案3 prefork
這個和方案1類似,只是先創建好進程。當有連接到來時,可以馬上使用這些進程。具體可以參考http://www.t086.com/code/apache2.2/mod/prefork.html
方案4 pre thread
這和方案2類似,先創建好線程,等連接到來時,省去了創建線程的開銷。
方案5 poll(reactor):非阻塞IO+IO複用
這個方案是基於I/O複用的select/poll/epoll;複用的是進程,不是I/O。這是一個單線程/進程的方案,在I/O事件到達後,直接在當前線程/進程處理I/O。單線程/進程的Reactor模式,在處理當前I/O事件時,如果有新的I/O事件到來,不能及時響應。這樣事件的優先級不能得到保證。
Lighttpd,libevent,libev採用這種方案。
方案6 reactor+thread-per-task
這個方案是爲每一個I/O事件創建一個線程,在新建的線程中處理I/O事件。注意,這裏是爲每個I/O事件創建一個線程,而不是爲每個連接創建線程。這樣一來,每個新建線程處理的I/O事件的結果會有out-of-order的可能,即多次處理後的順序和請求順序未必一直了。
方案7 reactor+worker thread
爲了避免方案6中的out-of-order的問題,在這個方案中,爲每個連接創建一個線程。但是線程數目受限於CPU。
方案8 reactor+thread pool
這個方案是,在reactor線程中,等待I/O事件,當I/O事件到來時,在thread pool中取出一個線程(不是新創建)來處理I/O事件。
方案9 reactors in threads
muduo和Netty採用的是這種方案。在一個main Reactor中負責accept,之後把建立的連接fd放到sub Reactor中,這個連接的所有操作都在sub Reactor中完成。這個方案的特點是one loop per thread,有多個thread。
方案10 reactors in process
這個是Nginx的方案,連接之間無交換時,這是很好的解決方案。Nginx每個工作進程都有一個event loop。
方案11 reactors+thread pool
這是方案8和方案9的混合體。即使用多個Reactor,有的負責accept,有的負責I/O事件的到來。再使用線程池,處理I/O事件。
更多的介紹請參見《Linux多線程服務端編程:使用muduo C++網絡庫》第3章。
1、必須用單線程的場合:程序需要fork;限制CPU佔有率;
2、單線程優缺點:簡單,但是事件沒有優先級處理機制;
--------------------------------------------好書推薦-----------------------------------------------------
Linux C/C++學習:
github源碼學習:redis,Nginx,mosquitto,skynet,teamtalk,libuv,libevent,muduo,evpp,網狐棋牌6603源碼,張小方easyMule,張小方filezilla,張小方flamingo,Gh0st,PCShare,鄭樹新acl,ananas-rpc,Tars,美圖twemproxy,zsummerX,log4z,libco,seastar
工具學習:cmake,keepalived/LVS,haproxy,CDN,kafka,log4xx,OpenResty,HBase,tengine
語言學習:lua,shell
書籍學習:
《Linux高性能服務器編程》 -- 作者:遊雙
http://download.csdn.net/download/analogous_love/9673008
《TCP/IP協議族》
《Netty權威指南(第2版)》
《Linux多線程服務端編程:使用muduo C++網絡庫》
《編程珠璣第2版·修訂版》
《編程珠璣(續)(修訂版)》
《Linux環境編程:從應用到內核》 -- Linux領域第一本將應用編程與內核實現相結合的圖書
《構建高可用Linux服務器(第4版)》
《編程之美——微軟技術面試心得》
《編程之法:面試和算法心得》
《劍指OFFER:名企面試官精講典型編程題(第2版)》
《程序員代碼面試指南:IT名企算法與數據結構題目最優解》
《數據結構(C語言版)(第2版) 嚴蔚敏 李冬梅 吳偉民 (編著)》
http://www.ryjiaoyu.com/book/details/3489
https://download.csdn.net/download/libaineu2004/10411905
《數據結構習題解析與實驗指導 李冬梅 張琪 (編著)》
http://www.bjfuacm.com/structure/
《數據結構與算法分析:C語言描述(原書第2版)》
《算法:C語言實現 (第1-4部分)基礎知識、數據結構、排序及搜索(原書第3版)》
《算法基礎:打開算法之門》《算法導論》
《妙趣橫生的算法(C語言實現) 第2版》
《程序員面試寶典(第5版)》
《深入理解計算機系統(第3版)》
作者:[美]W. Richard Stevens
《TCP/IP Illustrated,Volume 1》 -- TCP/IP詳解 卷1 協議
《Advanced Programming in the UNIX® Environment》 -- APUE,UNIX環境高級編程
《UNIX Network Programming》 -- UNP,UNIX網絡編程
被推薦爛了,書很厚,但只需要讀一小半:
第1-7章;基礎,特別是要理解TCP的雙工特性.
第14章;瞭解gather write/scatter read.
第16章;這是本書最最重要的一章。
第30章;
也就是說,這麼厚的書,只需要讀10章足矣,現在有信心了嗎?
作者:(美)梅耶(Scott Meyers)四部曲:
《Effective C++》 -- 有人說C++程序員可以分成兩類,讀過Effective C++的和沒讀過的。世界頂級C++大師Scott Meyers成名之作的第三版的確當得起這樣的評價。當您讀過這本書之後,就獲得了迅速提升自己C++功力的一個契機。
《More Effective C++》
《Effective STL》
《Effective modern C++》 -- 學習C++11只需要這一本書,請耐心多讀幾遍。
作者:(美) Stanley B. Lippman著
《C++ Primer》
《Essential C++》
《深度探索C++對象模型》
作者:[美]Martin Fowler 著
《重構 改善既有代碼的設計》
《UML精粹:標準對象建模語言簡明指南(第3版)》
作者:[美]Robert C. Martin 著
《代碼整潔之道》
《代碼整潔之道 程序員的職業素養》
MySQL學習:推薦幾本學習MySQL的好書
---------------------------------------好拿offer-------------------------------------------------------
網站學習:
https://leetcode.com/ -- LeetCode英文站點
https://leetcode-cn.com/ -- LeetCode中文站點
http://zhedahht.blog.163.com/ 何海濤,《劍指Offer——名企面試官精講典型編程題》
https://github.com/zhedahht/CodingInterviewChinese2 何海濤GitHub,《劍指Offer——名企面試官精講典型編程題》配套源碼
https://blog.csdn.net/v_JULY_v 七月在線,《編程之法:面試和算法心得》作者
https://github.com/julycoding 七月在線GitHub
https://blog.csdn.net/v_july_v/article/details/6543438 程序員面試、算法研究、編程藝術、紅黑樹、機器學習5大系列集錦
https://blog.csdn.net/v_july_v/article/details/49302193 《編程之法:面試和算法心得》勘誤
https://github.com/arkingc/note/tree/master/interview 面經彙總