1 Reply Latest reply: Jun 7, 2013 11:45 AM by Greybird-Oracle RSS

    Question on Avro schema management

    ralmuell
      Hi,

      in our use case, we need to generate Avro schema on the fly (given some business object structure) and install with Oracle NoSQL. I have
      the following questions:
      1. Is there an API to install the Avro schema in NoSQL. Ideally we'd like to avoid using the command line tool for this (and also creating
      a .avsc file)
      2. Any recommended way to make the Avro schema available on the client? Ideally we don't want to use any file system operations
      for this. Would it be a reasonable way to store the Avro schema itself as a String in NoSQL and then when the client connects to NoSQL,
      first thing it does is read the schemata stored in NoSQL and parse them?
      On another topic, are there any performance penalties using JsonAvroBinding vs. GenericAvroBinding. Our objects are all JSON so we'd
      like to use JsonAvroBinding, however we'd go the extra mile and use GenericAvroBinding if that performs better.

      Best Regards and thanks in advance for your answer,
      Ralf
        • 1. Re: Question on Avro schema management
          Greybird-Oracle
          Hello Ralf,
          1. Is there an API to install the Avro schema in NoSQL. Ideally we'd like to avoid using the command line tool for this (and also creating a .avsc file)
          No, there is no administrative API currently available. So currently, I think this would have to be done using a script that is invoked by your application and that uses the NoSQL DB admin CLI.
          2. Any recommended way to make the Avro schema available on the client? Ideally we don't want to use any file system operations for this. Would it be a reasonable way to store the Avro schema itself as a String in NoSQL and then when the client connects to NoSQL, first thing it does is read the schemata stored in NoSQL and parse them?
          The begs the question of how you'll do schema evolution. Will there ever be multiple versions of the same Avro schema (more than one version having the same schema name) in your application? If so, there will be additional complications with the approach you're taking.

          If not (if there will only ever be one version of a given schema), you can use the latest (only) version of a schema on the client. In that case you can call AvroCatalog.getCurrentSchemas to get the schemas you need. If a schema you recently added is not in the returned map, call AvroCatalog.refreshSchemaCache followed by AvroCatalog.getCurrentSchemas.
          On another topic, are there any performance penalties using JsonAvroBinding vs. GenericAvroBinding. Our objects are all JSON so we'd like to use JsonAvroBinding, however we'd go the extra mile and use GenericAvroBinding if that performs better.
          They should have similar performance characteristics -- they do essentially the same thing -- but I would guess that in general JsonAvroBinding is slightly faster than GenericAvroBinding, based on my knowledge of the Avro and Jackson code. However, we have not done any performance testing to compare them. It is possible that the answer depends on the schema you're using. So you should do your own testing, if you're concerned about minor performance differences.

          --mark