Code Monkey home page Code Monkey logo

dmf-framework's Introduction

Dmf-FrameWork

This project is a cross-platform web server framework implemented in C language,
supporting Linux and Windows operating systems, with the following features:

  • Adopts the traditional MVC pattern
  • Implements HTTP template functionality
  • Implements session functionality
  • Can be extended through middleware
  • Implements IP restriction functionality, adding the same IP to a blacklist if it frequently initiates requests
  • Supports asynchronous logging and IP monitoring middleware
  • Achieves a simple template HTTP request concurrency of up to 5600/sec(2023/5/8)

Technology Stack

  • Multi-threading
  • IO multiplexing
  • Thread pool
  • Connection pool
  • Shared memory
  • Integrated SSL and MySQL

Middleware

This framework supports extension through middleware. Currently, we have implemented the following middleware:

  • IP restriction middleware
  • Asynchronous logging middleware
  • IP monitoring middleware

Stress test results

result1 result3

To run this server:

1.Install MySql

You need to Install MySql first, then Create user , and Create a database.
Here is example:

create database dbtest charset=utf8;
create user 'pzc'@'localhost' identified by 'pzc123';
grant all privileges on dbtest.* to 'pzc'@'localhost';
plush privileges;

Pay attention: I used MySql(5.7), if you use aother version of MySql, please replace "include/mysql" and "lib/libmysql.lib". Don't forget to copy the libmysql.dll to "/bin".

2.Clone and Compile the project

git clone https://github.com/pengzechen/request
cd request
mkdir build
cd build
cmake ../CMakeLists.txt -G "MinGW Makefiles"
make

Pay attention: You need to have MinGW and it need to be in PATH Or you can Install Vistual Studio 2019

3.Configure "conf.xml"

Here is example:

<?xml version="1.0" encoding="gbk"?>
<dmfserver>
  <server>
	  <listen>80</listen>
  </server>
  <model>
    <host>localhost</host>
    <port>3306</port>
    <username>pzc</username>
    <password>pzc123</password>
    <database>dbtest</database>
  </model>
  <template>
	  <dir>./template</dir>
  </template>
  <static>
	  <dir>./static</dir>
  </static>
</dmfserver>

4.Run Server

cd ../bin
./server

5.Linux Configure

apt-get install -y libmysqlclient-dev libssl-dev libxml2-dev

Contribution

Contributions to this project are welcome. If you wish to contribute code, please email to me.

License

This project is licensed under the Apache license.

Some useful command lines

git config --global http.proxy 'socks5://127.0.0.1:1080'

netsh int ipv4 set dynamicport tcp start=1025 num=64500

dmf-framework's People

Contributors

pengzechen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.