GithubHelp home page GithubHelp logo

sniper's People

Contributors

bekars avatar btfak 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

sniper's Issues

Add HTTP/2 support

supporting HTTP/2 connections would be a nice feature that is probably easy to implement in go and most other tools don't support it (i know only h2load)

open ssl key err: open : no such file or directory

Steps to reproduce

I use Ubuntu 18.04 on a DigitalOcean droplet.

downloaded the linux 64 bit binary from readme

then only get this messages...

root@ubuntu-s-1vcpu-2gb-fra1-01:~# ./sniper_linux_amd64 -c 128 -t 60 https://codeberg.org/
read config file error: open /root/.sniperc: no such file or directory use default setting.
open ssl key err: open : no such file or directory
open : no such file or directory
root@ubuntu-s-1vcpu-2gb-fra1-01:~# echo $?
0

Only first url is ever used

The first url in the config file is the only one used. prepareContent() is called once and the index of the target array is always the first element:

path = config.Basic.target[0].path

postData.txt 格式是什么样的

username=name&password=123123 是这样吗?

还有要持久测试如何设置的? 为何设置请求100万次执行一万次就结束了。

HTTPS POST always "failing"

I have a server running, listen on 2 ports locally; HTTP on 8080 and HTTPS on 8443.

Sniper seems to be functioning properly when I make a HTTP POST, with an output like this.

user:sniper-benchmark user$ sniper -c 5 -n 100 -p file.json -T application/json http://localhost:8080/listening/path
This is Sniper ,version 1.0 
Copyright (C) 2013 by Lubia Yang, et al.
This is free software; open source on github.com/lubia/sniper.

The server is now under snipe ...

Completed 10 requests
Completed 20 requests
Completed 30 requests
Completed 40 requests
Completed 50 requests
Completed 60 requests
Completed 70 requests
Completed 80 requests
Completed 90 requests
Completed 100 requests
Transactions:                   100 hits
Availability:                   100.00 %
Elapsed time:                   0.05 secs
Document length:               101 Bytes
TotalTransfer:                  0.01 MB
Transaction rate:            2126.95 trans/sec
Throughput:                     0.20 MB/sec
Successful:                     100 hits
Failed:                           0 hits
TransactionTime:               2.270 ms(mean)
ConnectionTime:                0.135 ms(mean)
ProcessTime:                   2.134 ms(mean)
StateCode:                    100(code 200)

However, when I try to make a HTTPS POST, Sniper is having problems connecting with the service (I am able to POST via the command line curl command). My Sniper output looks like this.

user:sniper-benchmark user$ sniper -c 5 -n 100 -p file.json -T application/json https://localhost:8443/listening/path
This is Sniper ,version 1.0 
Copyright (C) 2013 by Lubia Yang, et al.
This is free software; open source on github.com/lubia/sniper.

The server is now under snipe ...

Transactions:                   1000000 hits
Availability:                    0.00 %
Elapsed time:                   0.57 secs
Document length:               101 Bytes
TotalTransfer:                  0.00 MB
Transaction rate:               0.00 trans/sec
Throughput:                     0.00 MB/sec
Successful:                     0 hits
Failed:                           1000000 hits
TransactionTime:               0.000 ms(mean)
ConnectionTime:                0.000 ms(mean)
ProcessTime:                   0.000 ms(mean)
StateCode:                    0(code 200)

Here is my .sniperc file used.

[protocol]
version = HTTP/1.1
#connection = keep-alive 
connection = close
#accept-encoding = gzip
user-agent = golang & sniper

[header]
#cookie = SSID=Abh_TYcDc6YSQh-GB

[process]
timeout = 100
failures = 1000000

[Authenticate]
#login = jeff:supersecret

[ssl]
ssl-cert = /path/to/ssl-cert
ssl-key = /path/to/ssl-key
ssl-timeout = 100

As you can see, I have put in valid paths to the ssl key/cert and tried to up the timeout/failures. But nothing seems to work. Any help would be appreciated.

长连接问题

Nginx等web服务器可以设置在长连接(KeepAlive)时,处理多少个请求关闭连接。在返回包的TCP头域中设置了FIN位。需要对这个位进行处理,重新建立连接,否则后续发送的请求不会被web服务器处理。ab对此有处理。

高压力情况下与服务端建立连接失败出现程序异常

参见如下代码work.go:
//http & https
if config.Basic.https {
c.conn, err = tls.Dial("tcp", ip+":"+port, c.tlsConfig)
c.conn.SetDeadline(begin.Add(time.Second * time.Duration(config.Ssl.timeout)))
} else {
c.conn, err = net.DialTCP("tcp", nil, c.tcpAddr)
c.conn.SetDeadline(begin.Add(time.Second * time.Duration(config.Process.timeout)))
}

if err != nil {
c.trans.totalTime = 0
record.trans <- c.trans
c.conn.Close()
c.connect()
}

不应该直接调用SetDeadline,应该先处理err,因为如果net.DialTCP出错,此时conn应该是空对象,调用SetDeadline就会出问题。同理如果err != null,也不应该调用Close.

出现错误如下:

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x4e7f57]

goroutine 950 [running]:
runtime.panic(0x5ec660, 0x85b948)
/usr/local/go/src/pkg/runtime/panic.c:266 +0xb6
net.(*TCPConn).SetDeadline(0x0, 0xecb2c9b93, 0x3b1dc367, 0x860300, 0xecb2c9b93, ...)
/usr/local/go/src/pkg/net/dial.go:1 +0x17

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.