Coder Social home page Coder Social logo

yangfei812 / mongols Goto Github PK

View Code? Open in Web Editor NEW

This project forked from weizai118/mongols

0.0 2.0 0.0 6.5 MB

C++ high performance networking with TCP/RESP/HTTP/WebSocket protocols

Home Page: https://mongols.hi-nginx.com

License: Mozilla Public License 2.0

Makefile 0.02% HTML 0.01% JavaScript 0.84% C++ 37.96% Lua 0.35% C 60.75% Objective-C 0.06%

mongols's Introduction

mongols

a library for c++

Libevent, libev and libuv are outdated.

dependency

  • linux
  • gcc (-std=c11)
  • g++ (-std=c++11)

feature

epoll or epoll + multi-threading + multi-process

  • tcp sever
  • http server
  • websocket server
  • web server
  • leveldb server
  • lua server
  • sqlite server
  • medis_server (like redis but support sqlite and leveldb)
  • javascript server
  • utils

install

make clean && make -j2 && sudo make install && sudo ldconfig

usage

pkg-config --libs --cflags mongols

leveldb_server usage

  • successful: 200

  • failed: 500

  • POST curl -d'key=value' http://host/key

  • GET curl http://host/key

  • DELETE curl -X DELETE http://host/key

sqlite_server usage

  • successful: 200
  • failed: 500
  • sql_type: cmd,transaction,query
  • sql: SQL statement
  • result: JSON

POST curl -d 'sql_type=x' -d 'sql=sql_statement' http://127.0.0.1:9090/

example: curl -d'sql_type=query' -d'sql=select * from test limit 3;' http://127.0.0.1:9090/

result: {"error":null,"result":[{"id":1,"name":"a"},{"id":2,"name":"b"},{"id":3,"name":"c"}]}

benchmark

2 core,4 GB,linux mint 18:

http

ab -kc 10000 -n 500000 -H 'Connection: keep-alive' http://127.0.0.1:9090/

ab_http.png

wrk -t 50 -d 30s -c 10000 -H 'Connection: keep-alive' http://127.0.0.1:9090/

wrk_http.png

web

ab_web.png

wrk_web.png

web_server VS nginx(1 worker)

mongolsVSnginx.png

multi-process web

ab_multi_process_web_server.png

wrk_multi_process_web_server.png

nginxVSmongols.png

medis

medis.png

example

example

mongols's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.