trinity

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2021 License: MIT Imports: 11 Imported by: 0

README

trinity-micro

cd example/benchmark
go run main.go api
% wrk -t12 -c100 -d10s http://127.0.0.1:3000/benchmark/simple_raw
Running 10s test @ http://127.0.0.1:3000/benchmark/simple_raw
  12 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   781.37us  442.87us   7.51ms   77.68%
    Req/Sec    10.53k   709.86    12.45k    65.98%
  1268705 requests in 10.10s, 181.49MB read
Requests/sec: 125611.65
Transfer/sec:     17.97MB


%  wrk -t12 -c100 -d10s http://127.0.0.1:3000/benchmark/simple          
Running 10s test @ http://127.0.0.1:3000/benchmark/simple
  12 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     0.94ms  848.65us  15.40ms   85.68%
    Req/Sec     9.83k     1.12k   12.75k    74.26%
  1184808 requests in 10.10s, 169.49MB read
Requests/sec: 117297.24
Transfer/sec:     16.78MB
%  wrk -t12 -c100 -d10s http://127.0.0.1:3000/benchmark/path_param_raw/1
Running 10s test @ http://127.0.0.1:3000/benchmark/path_param_raw/1
  12 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   795.47us  487.06us  11.88ms   78.66%
    Req/Sec    10.44k     0.87k   12.67k    64.60%
  1259132 requests in 10.10s, 176.52MB read
Requests/sec: 124669.29
Transfer/sec:     17.48MB

%  wrk -t12 -c100 -d10s http://127.0.0.1:3000/benchmark/path_param/1    
Running 10s test @ http://127.0.0.1:3000/benchmark/path_param/1
  12 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   835.88us  701.02us  22.89ms   90.41%
    Req/Sec    10.11k   646.21    12.74k    73.33%
  1207872 requests in 10.01s, 202.74MB read
  Non-2xx or 3xx responses: 1207872
Requests/sec: 120619.89
Transfer/sec:     20.25MB

Documentation

Overview

Author: Daniel TAN Date: 2021-10-02 22:31:49 LastEditors: Daniel TAN LastEditTime: 2021-10-03 23:02:06 FilePath: /trinity-micro/container.go Description:

Author: Daniel TAN Date: 2021-10-02 00:36:09 LastEditors: Daniel TAN LastEditTime: 2021-10-04 00:16:28 FilePath: /trinity-micro/di_router.go Description:

Author: Daniel TAN Date: 2021-10-02 22:54:19 LastEditors: Daniel TAN LastEditTime: 2021-10-02 22:54:21 FilePath: /trinity-micro/event.go Description:

Author: Daniel TAN Date: 2021-10-02 22:31:03 LastEditors: Daniel TAN LastEditTime: 2021-10-02 22:46:53 FilePath: /trinity-micro/router.go Description:

Author: Daniel TAN Date: 2021-09-06 00:13:18 LastEditors: Daniel TAN LastEditTime: 2021-10-04 01:37:32 FilePath: /trinity-micro/trinity.go Description:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DIHandler

func DIHandler(container *container.Container, instanceName string, funcName string, isRaw bool) func(w http.ResponseWriter, r *http.Request)

multi instance di handler

func DIRouter

func DIRouter(r mux, container *container.Container)

func InitInstance

func InitInstance(container *container.Container)

func RegisterController

func RegisterController(rootPath string, instanceName string, requestMaps ...RequestMap)

func RegisterInstance

func RegisterInstance(instanceName string, instancePool *sync.Pool)

func RouterSelfCheck

func RouterSelfCheck(container *container.Container)

Types

type Config

type Config struct {
	Mux    mux
	Logger logrus.FieldLogger
}

type RequestMap

type RequestMap struct {
	// contains filtered or unexported fields
}

func NewRawRequestMapping

func NewRawRequestMapping(method string, path string, funcName string, handlers ...func(http.Handler) http.Handler) RequestMap

func NewRequestMapping

func NewRequestMapping(method string, path string, funcName string, handlers ...func(http.Handler) http.Handler) RequestMap

type Trinity

type Trinity struct {
	logrus.FieldLogger
	// contains filtered or unexported fields
}

func Default

func Default() *Trinity

func New

func New(c ...Config) *Trinity

func (*Trinity) DIRouter

func (t *Trinity) DIRouter()

func (*Trinity) NewEvent

func (t *Trinity) NewEvent()

func (*Trinity) Start

func (t *Trinity) Start(addr ...string) error

Directories

Path Synopsis
core
e
httpx
* @Author: Daniel TAN * @Description: * @Date: 2021-08-06 11:05:44 * @LastEditTime: 2021-08-06 11:06:21 * @LastEditors: Daniel TAN * @FilePath: /fr-price-common-pkg/core/httpx/http_header_consts.go * @Author: Daniel TAN * @Description: * @Date: 2021-08-06 09:15:58 * @LastEditTime: 2021-09-07 10:46:38 * @LastEditors: Please set LastEditors * @FilePath: /fr-price-common-pkg/core/httpx/parse.go Author: Daniel TAN Date: 2021-09-05 10:24:33 LastEditors: Daniel TAN LastEditTime: 2021-10-03 14:56:13 FilePath: /trinity-micro/core/httpx/response.go Description:
* @Author: Daniel TAN * @Description: * @Date: 2021-08-06 11:05:44 * @LastEditTime: 2021-08-06 11:06:21 * @LastEditors: Daniel TAN * @FilePath: /fr-price-common-pkg/core/httpx/http_header_consts.go * @Author: Daniel TAN * @Description: * @Date: 2021-08-06 09:15:58 * @LastEditTime: 2021-09-07 10:46:38 * @LastEditors: Please set LastEditors * @FilePath: /fr-price-common-pkg/core/httpx/parse.go Author: Daniel TAN Date: 2021-09-05 10:24:33 LastEditors: Daniel TAN LastEditTime: 2021-10-03 14:56:13 FilePath: /trinity-micro/core/httpx/response.go Description:
utils
* @Author: Daniel TAN * @Description: * @Date: 2021-08-24 11:37:54 * @LastEditTime: 2021-08-24 12:56:19 * @LastEditors: Daniel TAN * @FilePath: /fr-price-common-pkg/core/utils/md5.go * @Author: Daniel TAN * @Description: * @Date: 2021-08-06 10:11:31 * @LastEditTime: 2021-08-26 10:53:30 * @LastEditors: Daniel TAN * @FilePath: /fr-price-common-pkg/core/utils/string_converter.go * @Author: Daniel TAN * @Description: * @Date: 2021-08-18 09:27:53 * @LastEditTime: 2021-08-18 09:28:00 * @LastEditors: Daniel TAN * @FilePath: /fr-price-common-pkg/core/utils/type_converter.go
* @Author: Daniel TAN * @Description: * @Date: 2021-08-24 11:37:54 * @LastEditTime: 2021-08-24 12:56:19 * @LastEditors: Daniel TAN * @FilePath: /fr-price-common-pkg/core/utils/md5.go * @Author: Daniel TAN * @Description: * @Date: 2021-08-06 10:11:31 * @LastEditTime: 2021-08-26 10:53:30 * @LastEditors: Daniel TAN * @FilePath: /fr-price-common-pkg/core/utils/string_converter.go * @Author: Daniel TAN * @Description: * @Date: 2021-08-18 09:27:53 * @LastEditTime: 2021-08-18 09:28:00 * @LastEditors: Daniel TAN * @FilePath: /fr-price-common-pkg/core/utils/type_converter.go
example

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL