-
Notifications
You must be signed in to change notification settings - Fork 15
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
XML parser option to forcibly use SimpleParser instead of NativeParser #48
Conversation
*/ | ||
public function __construct(Client $handler) | ||
public function __construct(Client $handler, bool $forceSimpleParser) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you set a default behaviour here ?
public function __construct(Client $handler, bool $forceSimpleParser=false)
Hi @diegosainz , Interesting, I'll check this week-end to know how to fix the travis issue (unit test + code style) and release a new version. In the meanwhile, you can always add your p/r in composer, see an example here in case you need a urgent fix. That said, I would not recomment to send the generated PDF through the pjb protocol. When using Jasper, I generally save the result in a file (the filename can be generated with tempnam for example) and read it back on the PHP side. It works great. I used this method to generate 700+ pages product catalogs (pictures...) without problems. |
Hi @belgattitude - thank you for your quick reply! I'll update the PR with the default constructor value for the new argument - good point. No rush on our side - we applied the Indeed, as you say, a better alternative would be for Jasper to the file and then serve it. Initially the report server was on another server and that was the quickest path. Either way you will be happy to know that we are generating 8,000-page pdfs (albeit just with a couple barcodes and some extra info) without much trouble using japha :) |
Hi @diegosainz , merged and released in 2.1.0. Congrats ! 8000 pages ;) Not sure about my own volume, but I used it for barcode generation too for two major shippers in belgium (track&trace)... But very nice to know what japha is used for, that gives me some motivation to opensource more ;) If you intend to setup an instance on the same server, be sure to check the latest phpjavabridge server fork. It's much more easy to produce a Documentation is also availble here: http://docs.soluble.io/soluble-japha/install_server/. Have fun and thanks again. Seb |
And if you like to, don't forget to star the project ;) Might give some extra motivation, hehe |
That was fast! Thank you, @belgattitude! :D I really appreciate the extra work required to open source something instead of just making quick changes and keep the fork private. Also I didn't know about the server fork! - thanks for pointing it out! it will be for sure in our product maintenance roadmap to use it instead of the old one. |
Great, I was curious about the performance difference between native and pure-php version of the parser, I you're interested:
See how All the best :) FYI, just documented the new option: http://docs.soluble.io/soluble-japha/bridge_connection/ |
Thank you @belgattitude! - I wonder if under OpCache it would be closer to the native implementation. Anyway, didn't know about the documentation page! it's great! (and even better how you have been mantling the small details with tips/summaries/etc). I will definitively take a look into |
Hey @diegosainz , yes I was wondering too... So I've re-run the benchsuite with latest php7.1.8 fpm and opcache, but it does not change a lot. (native still 25-30% faster). Anyway in real world usage I guess this does not make any differences, the bench suite is making a lot of calls ( 150.000 ping pongs ;) PS: Native parser bench
Pure-php parser bench;
|
@belgattitude interesting to have the raw benchmark, thank you!!. And that's right: in our use case the calls are minimum (a couple java calls to set up the byte stream, compile the reports, etc) and all the hard work is done by Jasper Reports. Probably we are in the order of less than 200 calls. |
@diegosainz , very good. Just out of curiosity, are you using PHP7.1 yet ? I've recently released the 2.0 milestone and updated the requirement to PHP7.1 (no api break) |
@belgattitude that was a JIT question! - we are right now migrating our production servers to PHP 7.1 (from 7.0). All our docker and tests environments are already running PHP 7.1 since last week. So far everything has been stable (but we are not using the latest version of |
Great, don't forget to update to Keep the good work. |
Hey @diegosainz , Just started working on a jasper wrapper with the bridge. You can have a look at https://github.com/belgattitude/soluble-jasper. It's in early stages now. I'm currently trying to stabilize the API before starting the doc... and optimize. I would really appreciate your comments on this (api, features, ideas, experiences... ?). See also the benchmarks on the project page, I'll improve it over time. All the best Thanks, Seb |
Hi Sébastien,
At work we have been through a couple of busy days to diagnose and workaround a problem in PHP's
xml_parse
native functions while parsing large values in XML attributes.The problem is that
xml_parse
(at least from PHP 5.5 to PHP 7.1) limits the maximum size of any XML node's attribute value to 10M (it can progressively parse XML files of any size, but not attribute values of any size - find here a script that I created to demostrate that). This seems related to the change that was done tolibxml2
to limit the memory while parsing. The optionXML_PARSE_HUGE
can be passed to the C library to overcome that limitation, but sadly PHP'sxml_parse
does not supports it yet.As we use soluble-japha mainly for Jasper Reports, when there is a PDF of a couple thousand pages, the response will come as a base64-encoded XML node attribute value that is easily greater than the
xml_parser
limit of 10M.This PR adds the following features:
SimpleParser
instead ofNativeParser
. The SimpleParser parses huge Pjb62 without any problem.And fixes the following issues:
PjbProxyClient
were impossible to be overriden.Due to the nested singleton objects I had some trouble to create the unit tests. I finally settled on using reflection to force the re initialization of the
PjbProxyClient
object and be able to unit test its configuration.Right now my hacky workaround is to artificially define the
HHVM_VERSION
constant to fool theParser
class into usingSimpleParser
(yeah, I know...).