Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems using bench-rest with Dreamfactory #12

Closed
davidweiner-df opened this issue Sep 3, 2015 · 9 comments
Closed

Problems using bench-rest with Dreamfactory #12

davidweiner-df opened this issue Sep 3, 2015 · 9 comments

Comments

@davidweiner-df
Copy link

I am attempting to use bench-rest to benchmark the performance of Dreamfactory (https://github.com/dreamfactorysoftware/dreamfactory). When I use other tools such as curl, Advanced Rest Client or our built in test tool, I am able to connect to the REST api and perform any action. However, even the simplest actions, such as getting a list of database tables fails when using bench-rest with a 500 error. Using other tools, I get the expected response:

{
"resource": [
{
"name": "test_table"
}
]
}

Using the simple get request capabilities of bench-rest, this is the result (username and password obfuscated)

bench-rest -u XXX -p XXX http://52.20.104.223/api/v2/DBTest/_table
Benchmarking 1 iteration(s) using up to 1 concurrent connections using basic auth user davidweiner@dreamfactory.com

flow: http://52.20.104.223/api/v2/DBTest/_table

Failed in main, err: [Error: error statusCode: 500]
Progress [=======================================] 100% 0.0s conc:0 4/s

errors: 1
stats: { totalElapsed: 282.82533200085163,
main:
{ meter:
{ mean: 3.5350537770750914,
count: 1,
currentRate: 3.5350037788768995,
'1MinuteRate': 0,
'5MinuteRate': 0,
'15MinuteRate': 0 },
histogram:
{ min: 279.80505799874663,
max: 279.80505799874663,
sum: 279.80505799874663,
variance: null,
mean: 279.80505799874663,
stddev: 0,
count: 1,
median: 279.80505799874663,
p75: 279.80505799874663,
p95: 279.80505799874663,
p99: 279.80505799874663,
p999: 279.80505799874663 } } }

Using the exact same credentials and URL, both cURL, Advanced Rest Client and our own REST test application all work and return the list of tables. I've used wireshark to sniff the connection, and I can't see any significant differences between it and the cURL request.

I would be happy to provide you with the proper credentials to troubleshoot this. I'm fresh out of ideas and would appreciate any insight you could provide.

@jeffbski
Copy link
Owner

jeffbski commented Sep 3, 2015

David,

That is strange. Nothing from what you described sounds out of the ordinary.

I can certainly take a closer look and see if I can determine what is going on.

You can email me at jeff.barczewski@gmail.com with credentials and anything I need to know beyond what is in this issue.

Thanks,

Jeff

@jeffbski
Copy link
Owner

jeffbski commented Sep 3, 2015

David,

It looks like the REST service you are hitting is expecting an "Accept" header which is an optional HTTP header.

Without the Accept header the service is actually responding with a 500 error.

If you add in the Accept header then it seems to work fine.

bench-rest only sets the header Connection: keep-alive by default, however you can pass in a headers object in the flow definition to have it add whatever.

If you want to do it from the command line you could do the request as follows (or add it to a flow.json and just refer to that file from the command line instead of the url).

bench-rest -u xxx -p xxx -e "{ get: 'http://YOURURL', headers: { Accept: '*/*' }}"

Ideally the REST service shouldn't require the Accept header since it is optional (implies */* if absent), but at least you will know how to specify if you need to.

I guess the tools you were using were automatically adding the Accept: */* header by default and that's why they worked.

Hope that explains things and gets you going.

All the best,

Jeff

@davidweiner-df
Copy link
Author

That is indeed it! Thanks Jeff! I'll get with the primary developers about that. Thanks again!

@jeffbski
Copy link
Owner

jeffbski commented Sep 3, 2015

You are quite welcome. I am glad I was able to help.

@davidweiner-df
Copy link
Author

I've got another strange one.... for some reason, after I successfully
create a table in the before method using bench-rest, additional calls
(after dropping the table) give a 500 error, even when setting the
Accept header.

Not a biggie, I can work around that by just creating the table before
the test by hand.

Dave

Jeff Barczewski wrote:

You are quite welcome. I am glad I was able to help.


Reply to this email directly or view it on GitHub
#12 (comment).

Dave Weiner | Sr. Software Engineer | DreamFactory | t.678 536.9244
tel:678%20536.9244 | @dfsoftwareinc | DreamFactory
http://www.dreamfactory.com

@jeffbski
Copy link
Owner

jeffbski commented Sep 3, 2015

Do you have the accept header in each item of the flow? Each of those is separate?

@davidweiner-df
Copy link
Author

Yup! Record inserts are working, so I'm not too worried about it, but
if you would like to try and get to the bottom of it, I'm happy to work
with you.

Dave

Jeff Barczewski wrote:

Do you have the accept header in each item of the flow? Each of those
is separate?


Reply to this email directly or view it on GitHub
#12 (comment).

Dave Weiner | Sr. Software Engineer | DreamFactory | t.678 536.9244
tel:678%20536.9244 | @dfsoftwareinc | DreamFactory
http://www.dreamfactory.com

@jeffbski
Copy link
Owner

jeffbski commented Sep 3, 2015

I can take a quick look if you want to send me the details.

@jeffbski
Copy link
Owner

jeffbski commented Sep 7, 2015

I just sent you an email regarding that. I think it was due to slightly wrong syntax in your flow for the headers. It takes an object not an array of objects. After fixing that everything seems to work without errors for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants