voxpupuli / json-schema

Ruby JSON Schema Validator
MIT License
1.54k stars 243 forks source link

Fetching external schema is extremly slow #236

Closed abidon closed 12 months ago

abidon commented 9 years ago

My validation schema references other schemas that are hosted on a web server. The fetching of these external schemas seems to be extremly slow:

I can see with nettop the fetching of theses external schemas is done one by one, could it be multithreaded ?

But even with multi-threaded fetch, it would still be very slow IMO. I can't explain why, but I may be able to give some clues:

time curl http://developers.heyvent.overhead.ovh/schemas/uuid > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   163  100   163    0     0    713      0 --:--:-- --:--:-- --:--:--   711

real    0m0.234s
user    0m0.003s
sys 0m0.004s
time ./validator.rb schemas/event {} > /dev/null

real    3m46.930s
user    0m0.137s
sys 0m0.023s

Here's the validator.rb script and schemas/event JSON schema (I'm new with ruby and just wanted to make a quick working tool so please don't judge this horrible piece of code :smile:)

If you need me to test things or give you more information, just tell me ;)