HTTPerf send JSON data from file

家住魔仙堡 提交于 2019-12-11 14:05:12

问题


Need to use this httperf as ab is returning SSL errors.

Operating System

Ubuntu 16 (Google Cloud Linux tools 4.15.0-1036-gcp #38~16.04.1-Ubuntu)

curl (curl works fine)

ACCESS_TOKEN=`gcloud auth print-access-token`
export URL=https://ml.googleapis.com/v1/projects/dpe-cloud-mle/models/pretrained_model/versions/gpu:predict
curl -X POST $URL -d @image_b64.json \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $ACCESS_TOKEN" 

ab testing tool

ab -n 10 -c 1 -s 300 \
-f ALL \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Accept-Encoding: gzip,deflate" \
-p image_b64.json $URL

Returns errors and in packet capture SSL handshake never completes. My understanding is that apache ab does not handle SSL properly most of the time. Reference: How do I fix "ssl handshake failed" with ApacheBench?

Benchmarking ml.googleapis.com (be patient)...SSL write failed - closing connection
..done


Server Software:        
Server Hostname:        ml.googleapis.com
Server Port:            443
SSL/TLS Protocol:       TLSv1.2,ECDHE-RSA-AES128-GCM-SHA256,2048,128

Document Path:          /v1/projects/dpe-cloud-mle/models/pretrained_model/versions/gpu:predict
Document Length:        0 bytes

Concurrency Level:      1
Time taken for tests:   0.004 seconds
Complete requests:      1
Failed requests:        0
Total transferred:      0 bytes
Total body sent:        0
HTML transferred:       0 bytes
Requests per second:    254.91 [#/sec] (mean)
Time per request:       3.923 [ms] (mean)
Time per request:       3.923 [ms] (mean, across all concurrent requests)
Transfer rate:          0.00 [Kbytes/sec] received
                        0.00 kb/s sent
                        0.00 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        4    4   0.0      4       4
Processing:     0    0   0.0      0       0
Waiting:        0    0   0.0      0       0
Total:          4    4   0.0      4       4

How can I configure httperf to send image_b64.json?

image_b64.json is a ~56K file .

httperf --hog --server ml.googleapis.com \
  --uri=/v1/projects/dpe-cloud-mle/models/pretrained_model/versions/gpu:predict \
  --ssl \
  --method=POST \
  --add-header="Content-Type: application/json\n" \
  --add-header="Authorization: Bearer $ACCESS_TOKEN\n" \
  --timeout=10 --num-conns=10 --rate=1 \
  --wsesslog=150,0,httprefpost_data.txt

My understanding is that I need to setup: httprefpost_data.txt

/v1/projects/dpe-cloud-mle/models/pretrained_model/versions/gpu:predict method=POST contents=

and next to contents I assume I need to put the whole content of image_b64.json?

When I do that I get:

httperf --hog --server ml.googleapis.com   --uri=/v1/projects/dpe-cloud-mle/models/pretrained_model/versions/gpu:predict   --ssl   --method=POST   --add-header="Content-Type: application/json\n"   --add-header="Authorization: Bearer $ACCESS_TOKEN\n"   --timeout=10 --num-conns=1 --rate=1   --wsesslog=150,0,httprefpost_data.txt
httperf --hog --timeout=10 --client=0/1 --server=ml.googleapis.com --port=443 --uri=/v1/projects/dpe-cloud-mle/models/pretrained_model/versions/gpu:predict --rate=1 --send-buffer=4096 --recv-buffer=16384 --ssl --add-header='Authorization: Bearer ya29.c.ElxdB5jHc_XhRiuh1kBStykfzIOV9NZBL-Wn1NASWcNmtFj7dzWVc6dlTJdFltP3hYfszayQwe7YFW3tIRhC7v9q7nQDWPTgytrI82-Y4pFCYPRSMveffN4ImYK97Q\n' --method=POST --wsesslog=150,0.000,httprefpost_data.txt
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
httperf: did not recognize arg ':' in httprefpost_data.txt

来源:https://stackoverflow.com/questions/57388663/httperf-send-json-data-from-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!