-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Performace] -- Instance validation is very slow when the instance data set is considerably huge #28
Comments
I've encountered similar issues, AFAIK there are two reasons. First the backing data structure involves a lot of data copy when traversing the tree. It comes from the Second there is no indexing for list instances, so looking up a list item by its key(s) is O(n). An indexing mechanism should be added to make it O(1). |
Yes, I made a similar experience when I tried to feed the entire .com DNS zone to an instance tree. But what was really slow was to read the data and build the tree. Traversing and modifying the zipper tree does have some overhead compared to a standard tree but the actual size of the tree shouldn't IMO play much role - all such operations are localised. I think the slowness is partly due to Python, including the fact that Python doesn't support tail recursion, which may be significant when validating a deep tree. I guess it is fair to say that Yangson isn't really suitable for huge instance data. |
@llhotka I see same behavior is observed with libyang as well. are there any other tools available to validate yang instance efficiently? |
How did you overcome this? |
I haven't yet but I would like to improve the data structures in yangson. Quick experiment to show the impact:
I expect the list copy is done many times when checking a constraint because it traverses the tree. While it's true that Python is not fast in general, all those operations could take the same time. For other performance problems like recursion and number of function calls/object allocations, doing more pre-computations on the schema and caching on the instance nodes might help. Of course that's not straightforward, you need to do a lot of profiling to figure out what could help. |
Hello, just a friendly question if there's some development going on to address this. We've stumbled upon this problem at @Telecominfraproject. Here's the data that we're loading, here's the A call to |
There are no plans for such development, it would probably mean writing something entirely different. |
Hi,
I am trying to use Yangson in Sonic and as part of my experiment, I am trying to load huge instance data for validation. Although validation goes through but it is taking huge time to complete.
In my case I have sample yang for ACL. I am trying to create 1000 ACLs with 5 rules each and yang has one must expression.
Is there any way to improve performance. Can you please look into this case how to make yangson highly performant. Practically instance data will be huge in the production system.
Attaching a tar file containing dependent yang models along with instance data JSON file (acl_1000.json) along with metadata file (yang-library-ext2.json).
Command line:
bash-3.2$ time yangson yang-library-ext2.json -p ../common/:. -v acl_1000.json
real 62m59.614s
samples.zip
user 62m45.841s
sys 0m4.968s
bash-3.2$ yangson -V
yangson 1.3.43
The text was updated successfully, but these errors were encountered: