arangodb / arangodb-php

PHP ODM for ArangoDB
https://www.arangodb.com
Apache License 2.0
183 stars 44 forks source link

Curl? #141

Open F21 opened 11 years ago

F21 commented 11 years ago

I noticed that the driver uses fopen instead of curl under the hood.

Is there any particular reason why fopen as chosen as the preferred method? If there's no particular reason, and it is acceptable to allow CURL as a dependency, should we move to using CURL?

jsteemann commented 11 years ago

There are two things to consider:

As mentioned, I think the first obstacle is minor, the impact of the second one depends on the point of view or usage. If no one uses Unix domain sockets for connecting, it can be removed and the move to cURL makes much sense. If people use it a lot (I doubt, as Unix domain sockets are not available on Windows, for example), then the move should probably be announced and then done for some upcoming version.

My personal opinion is that we should move to cURL if we wouldn't have the Unix domain socket option. Because we have it, we should check whether someone objects against moving to cURL. I'd say if no one complains after some period, this can be interpreted as "no complaints".

F21 commented 11 years ago

I have not actually considered the point about unix sockets as I have been using HTTP exclusively. Since ArangoDB supports sockets, it is something to consider.

Maybe we can refactor the code so that the current interfaces remain the same, but there are options to choose CURL or sockets as the underlying driver?

@frankmayer what do you think?

Would love to hear from other users of the library too. :smile:

Personally, for me, I would prefer to drop unix socket support and move to CURL completely. However, I am using ArangoDB over HTTP exclusively. Are there any benefits to using UNIX sockets rather than HTTP?

frankmayer commented 11 years ago

Yes, both points, Jan raised are valid. I looked into Curl, too and it could be done at some point. But personally, I think we should stay with fopen in this driver versions (1.x) or until the low-level one is out.

Why? a) It does the Job its supposed to, fine. b) Introducing curl, would mean that it must be included as an extension in PHP (se Jan's dependency reason) c) If there is any really important and vital reason to do so? Does it for example have some big performance improvement or such? d) And of course, sockets. Personally I like sockets on Unix/Linux as they are a lot faster.Haven't yet tested the performance with ArangoDB, yet. However, since it is provided by the API, the driver should support it.

In my local devel environment for the ArangoDB low-level driver I have done some groundwork in making it all pluggable, but haven't decided yet on the final way to go. There are some performance and usability factors to consider and a few tests to run, concerning performance. There are many ways to do it and I want to find the best balance. In the end you can use whichever mechanism you want. FOpen, Curl, or anything else that you want.

Please bare with me a bit longer, while I still struggle with some other projects, until I can finally devote my time to provide a fine solution in the form of a new low level driver. :smile:

razvanphp commented 9 years ago

I would suggest to think about guzzle too, as it is already included in many API SDKs, like AWS. It seems it also supports unix sockets.

http://mtdowling.com/blog/2014/10/13/guzzle-5/

I think the biggest performance improvement would be if multiple requests are done asynchronous, but I don't know if that's the case with arango API and cursors.

frankmayer commented 9 years ago

Thanks for your input. Have heard of it, but no hands on experience yet.