[OTDev] Significant milestone reached -- MLR model training

Vedrin Jeliazkov vedrin.jeliazkov at gmail.com
Sat Jan 2 12:10:50 CET 2010


Hi Pantelis,

2009/12/31 chung <chvng at mail.ntua.gr>:
> We may use ab (apache benchmark) as follows:
>
> ab -p @/home/chung/Desktop/post.txt  -T
> application/x-www-form-urlencoded -n 100
> http://servername:1234/serviceuri
>
> The file @/home/chung/Desktop/post.txt contains the posted data, e.g.:
>
> dataset_uri=http://localhost/ds.rdf&target=http://sth.com/feature/1
>
> For further details see the manual of the command (man ab).

Putting a @ symbol in front of the file name results in the following
ab message:

ab: Could not open POST data file (@/home/vedrin/post-local.txt): No
such file or directory

so I presume it shouldn't be there.

I've tried running 2 different ab post requests, but so far I didn't
manage to get the expected response (code 200). The setup and response
for the first attempt were as follows:

ambit:/home/vedrin# ab -c 1 -n 1 -v 9 -T
application/x-www-form-urlencoded -p /home/vedrin/post-local.txt
http://opentox.ntua.gr:3000/algorithm/mlr
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking opentox.ntua.gr (be patient)...INFO: POST header ==
---
POST /algorithm/mlr HTTP/1.0
Content-length: 74
Content-type: application/x-www-form-urlencoded
Host: opentox.ntua.gr:3000
User-Agent: ApacheBench/2.3
Accept: */*


---
LOG: header received:
HTTP/1.0 400 The request could not be understood by the server due to
malformed syntax
Content-Type: text/plain
Date: Sat, 02 Jan 2010 10:24:29 GMT
Accept-Ranges: bytes
Server: Noelios-Restlet/2.0m3
Connection: close
Transfer-Encoding: chunked

238
Error Report.
TimeStamp: Sat Jan 02 05:24:29 EST 2010

Error #1
Exception Details: java.net.URISyntaxException: Illegal character in
path at index 24: http://sth.com/feature/1

Explanation: [Wrong Posted Parameter ]: The client did not post a
valid URI for the target feature
For debugging reasons we provide a brief list of the exceptions:
- java.net.URI$Parser.fail(URI.java:2809)
- java.net.URI$Parser.checkChars(URI.java:2982)
- java.net.URI$Parser.parseHierarchical(URI.java:3066)
- java.net.URI$Parser.parse(URI.java:3014)
- java.net.URI.<init>(URI.java:578)



0


WARNING: Response code not 2xx (400)
..done


Server Software:        Noelios-Restlet/2.0m3
Server Hostname:        opentox.ntua.gr
Server Port:            3000

Document Path:          /algorithm/mlr
Document Length:        580 bytes

Concurrency Level:      1
Time taken for tests:   0.135 seconds
Complete requests:      1
Failed requests:        0
Write errors:           0
Non-2xx responses:      1
Total transferred:      833 bytes
Total POSTed:           245
HTML transferred:       580 bytes
Requests per second:    7.39 [#/sec] (mean)
Time per request:       135.281 [ms] (mean)
Time per request:       135.281 [ms] (mean, across all concurrent requests)
Transfer rate:          6.01 [Kbytes/sec] received
                        1.77 kb/s sent
                        7.78 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       16   16   0.0     16      16
Processing:   120  120   0.0    120     120
Waiting:      113  113   0.0    113     113
Total:        135  135   0.0    135     135

The contents of the post-local.txt file is:

dataset_uri=http://opentox.ntua.gr/ds.rdf&target=http://sth.com/feature/1

In a second attempt, I tried to urlencode the contents of the
post-local.txt like this:

dataset_uri=http%3A%2F%2Fopentox.ntua.gr%2Fds.rdf&target=http%3A%2F%2Fsth.com%2Ffeature%2F1

... but this didn't work either:

ambit:/home/vedrin# ab -c 1 -n 1 -v 9 -T
application/x-www-form-urlencoded -p
/home/vedrin/post-local-urlencoded.txt
http://opentox.ntua.gr:3000/algorithm/mlr
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking opentox.ntua.gr (be patient)...INFO: POST header ==
---
POST /algorithm/mlr HTTP/1.0
Content-length: 92
Content-type: application/x-www-form-urlencoded
Host: opentox.ntua.gr:3000
User-Agent: ApacheBench/2.3
Accept: */*


---
LOG: header received:
HTTP/1.0 400 The request could not be understood by the server due to
malformed syntax
Content-Type: text/plain
Date: Sat, 02 Jan 2010 10:24:17 GMT
Accept-Ranges: bytes
Server: Noelios-Restlet/2.0m3
Connection: close
Transfer-Encoding: chunked

238
WARNING: Response code not 2xx (400)
..done


Server Software:        Noelios-Restlet/2.0m3
Server Hostname:        opentox.ntua.gr
Server Port:            3000

Document Path:          /algorithm/mlr
Document Length:        580 bytes

Concurrency Level:      1
Time taken for tests:   0.170 seconds
Complete requests:      1
Failed requests:        0
Write errors:           0
Non-2xx responses:      1
Total transferred:      833 bytes
Total POSTed:           263
HTML transferred:       580 bytes
Requests per second:    5.90 [#/sec] (mean)
Time per request:       169.564 [ms] (mean)
Time per request:       169.564 [ms] (mean, across all concurrent requests)
Transfer rate:          4.80 [Kbytes/sec] received
                        1.51 kb/s sent
                        6.31 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       16   16   0.0     16      16
Processing:   154  154   0.0    154     154
Waiting:      153  153   0.0    153     153
Total:        170  170   0.0    170     170

As you can see, the returned response code is the same as in the first
attempt (the only difference being that there's no any error report in
the second case).

Apparently ab doesn't send the correct post request. I've tried
sniffing the post request and comparing it to the one sent by curl.

1) ab

12:45:56.856881 IP ambit.uni-plovdiv.bg.53342 > 147.102.82.32.3000: P
0:245(245) ack 1 win 46 <nop,nop,timestamp 34816386 359527596>
        0x0000:  4500 0129 eae4 4000 4006 8bba c28d 1b1c  E..).. at .@.......
        0x0010:  9366 5220 d05e 0bb8 55f6 ab9d e87d a761  .fR..^..U....}.a
        0x0020:  8018 002e 9afe 0000 0101 080a 0213 4182  ..............A.
        0x0030:  156d f4ac 504f 5354 202f 616c 676f 7269  .m..POST./algori
        0x0040:  7468 6d2f 6d6c 7220 4854 5450 2f31 2e30  thm/mlr.HTTP/1.0
        0x0050:  0d0a 436f 6e74 656e 742d 6c65 6e67 7468  ..Content-length
        0x0060:  3a20 3734 0d0a 436f 6e74 656e 742d 7479  :.74..Content-ty
        0x0070:  7065 3a20 6170 706c 6963 6174 696f 6e2f  pe:.application/
        0x0080:  782d 7777 772d 666f 726d 2d75 726c 656e  x-www-form-urlen
        0x0090:  636f 6465 640d 0a48 6f73 743a 206f 7065  coded..Host:.ope
        0x00a0:  6e74 6f78 2e6e 7475 612e 6772 3a33 3030  ntox.ntua.gr:300
        0x00b0:  300d 0a55 7365 722d 4167 656e 743a 2041  0..User-Agent:.A
        0x00c0:  7061 6368 6542 656e 6368 2f32 2e33 0d0a  pacheBench/2.3..
        0x00d0:  4163 6365 7074 3a20 2a2f 2a0d 0a0d 0a64  Accept:.*/*....d
        0x00e0:  6174 6173 6574 5f75 7269 3d68 7474 703a  ataset_uri=http:
        0x00f0:  2f2f 6f70 656e 746f 782e 6e74 7561 2e67  //opentox.ntua.g
        0x0100:  722f 6473 2e72 6466 2674 6172 6765 743d  r/ds.rdf&target=
        0x0110:  6874 7470 3a2f 2f73 7468 2e63 6f6d 2f66  http://sth.com/f
        0x0120:  6561 7475 7265 2f31 0a                   eature/1.

2) curl

12:48:44.915938 IP ambit.uni-plovdiv.bg.53723 > 147.102.82.32.3000: P
0:329(329) ack 1 win 46 <nop,nop,timestamp 34858401 359569609>
        0x0000:  4500 017d 209d 4000 4006 55ae c28d 1b1c  E..}.. at .@.U.....
        0x0010:  9366 5220 d1db 0bb8 f298 c507 8651 ab20  .fR..........Q..
        0x0020:  8018 002e 86b9 0000 0101 080a 0213 e5a1  ................
        0x0030:  156e 98c9 504f 5354 202f 616c 676f 7269  .n..POST./algori
        0x0040:  7468 6d2f 6d6c 7220 4854 5450 2f31 2e31  thm/mlr.HTTP/1.1
        0x0050:  0d0a 5573 6572 2d41 6765 6e74 3a20 6375  ..User-Agent:.cu
        0x0060:  726c 2f37 2e31 382e 3220 2878 3836 5f36  rl/7.18.2.(x86_6
        0x0070:  342d 7063 2d6c 696e 7578 2d67 6e75 2920  4-pc-linux-gnu).
        0x0080:  6c69 6263 7572 6c2f 372e 3138 2e32 204f  libcurl/7.18.2.O
        0x0090:  7065 6e53 534c 2f30 2e39 2e38 6720 7a6c  penSSL/0.9.8g.zl
        0x00a0:  6962 2f31 2e32 2e33 2e33 206c 6962 6964  ib/1.2.3.3.libid
        0x00b0:  6e2f 312e 3820 6c69 6273 7368 322f 302e  n/1.8.libssh2/0.
        0x00c0:  3138 0d0a 486f 7374 3a20 6f70 656e 746f  18..Host:.opento
        0x00d0:  782e 6e74 7561 2e67 723a 3330 3030 0d0a  x.ntua.gr:3000..
        0x00e0:  4163 6365 7074 3a20 2a2f 2a0d 0a43 6f6e  Accept:.*/*..Con
        0x00f0:  7465 6e74 2d4c 656e 6774 683a 2037 330d  tent-Length:.73.
        0x0100:  0a43 6f6e 7465 6e74 2d54 7970 653a 2061  .Content-Type:.a
        0x0110:  7070 6c69 6361 7469 6f6e 2f78 2d77 7777  pplication/x-www
        0x0120:  2d66 6f72 6d2d 7572 6c65 6e63 6f64 6564  -form-urlencoded
        0x0130:  0d0a 0d0a 6461 7461 7365 745f 7572 693d  ....dataset_uri=
        0x0140:  6874 7470 3a2f 2f6f 7065 6e74 6f78 2e6e  http://opentox.n
        0x0150:  7475 612e 6772 2f64 732e 7264 6626 7461  tua.gr/ds.rdf&ta
        0x0160:  7267 6574 3d68 7474 703a 2f2f 7374 682e  rget=http://sth.
        0x0170:  636f 6d2f 6665 6174 7572 652f 31         com/feature/1

As far as I can say, there are two differences between the requests:

1) curl sends a HTTP/1.1 request, while ab uses  HTTP/1.0

2) the ab request is terminated with the 0a symbol (in hex), which
corresponds to line feed, while curl's request doesn't include such
terminating symbol

I don't know whether the problem is due to one or both of these
differences. I was not able to find a way to avoid them. I'm a bit
lost what's going wrong... Any hints on how to make the ab post
request succeed would be most appreciated :-)

Kind regards,
Vedrin



More information about the Development mailing list