Comments (10)
I think it's not a python problem because the python function sess.apply_changes()
is just a direct wrapper of sr_apply_changes
. I'll test with a C program and check the results.
from sysrepo.
What sysrepo version are you using? Those numbers look rather extreme.
from sysrepo.
It's built from the master version yesterday.
from sysrepo.
Then please include more details. You are first calling sr_set_item_str()
for all the interfaces and then sr_apply_changes()
? What did you measure, only the sr_apply_changes()
call? What nodes are created for each interface?
from sysrepo.
I tested with a python script:
#!/usr/bin/env python
# benchmark.py
import sysrepo
import sys
import time
def main():
count = 1000
if len(sys.argv) > 1:
count = int(sys.argv[1])
with sysrepo.SysrepoConnection() as conn:
with conn.start_session() as sess:
sess.switch_datastore("running")
sess.delete_item("/ietf-interfaces:interfaces")
sess.apply_changes()
# generate fake config
data = {
"interfaces": {
"interface": []
}
}
for i in range(count):
data["interfaces"]["interface"].append({
"name": f"eth{i}",
"type": "ethernet-std:ethernetCsmacd"
})
sess.edit_batch(data, "ietf-interfaces")
start = time.time()
sess.apply_changes()
end = time.time()
print(f"Time used in apply_changes: {end-start}")
if __name__ == '__main__':
main()
Run with python3 benchmark.py <count>
.
from sysrepo.
Meaning it is at least to some extent running in Python. Then is not relevant, Python is known to be slow. Please try measuring C code directly, otherwise I can never be sure the benchmark has accurate numbers.
from sysrepo.
I created the same program in C and tested again. Here are my findings:
- I removed all yang modules, and only install [email protected] and [email protected]. Both C and python programs run very fast. The time looks very linear. The function
sr_apply_changes
can finish in 6 seconds with 100k interfaces. - When I load our yang, the performance drops significantly. We use a lot of augment, leafref, and when conditions. I'm not sure which place caused the performance issue. I'll continue investigating.
from sysrepo.
I found time was spent in data validation. Our yang has augments like this:
augment "/if:interfaces/if:interface" {
when "if:type = 'eth-std:ethernetCsmacd'";
container ethernet {
leaf mtu {
type eth-std:IF_MTU;
default "2000";
description
"Ethernet port MTU";
}
// more stuff....
}
Though my test program only sets name
and type
, sysrepo generates the missing leaf nodes with default values, then does the validation. My questions are:
- Can we skip generating nodes with default values?
- Can we skip validation?
from sysrepo.
- No, they are required to be part of the datastore data for everything to work correctly.
- No, the stored data are expected to and must be valid.
I am guessing you have added much more nodes and conditions because the ones posted should not cause any significant validation issues. I would suggest you optimize those conditions (and I can help with that if you can post it) or even validation can perhaps be optimized in case there are inefficiencies.
from sysrepo.
Thanks. My yang files are a bit chaotic. I think you can close this issue now. I'll try to clean up my yang modules.
from sysrepo.
Related Issues (20)
- Suggest configurable timeout for getting operational state data HOT 6
- Question: Force triggering change callback HOT 4
- Can a plugin modify module B based on changes in module A? HOT 2
- sysrepoctl segmentation fault when installing module HOT 4
- Can a plugin modify module B based on changes in module A when validation of module A depends on module B? HOT 11
- inconsistent `location` leaf-list within the `ietf-yang-library` HOT 1
- Question: Public API to use NACM to filter data? HOT 4
- [ERR] Data model "ietf-netconf-monitoring@2010-10-04" not found in local searchdirs. HOT 1
- `sr_module_change_subscribe` appears to provide config data in the operational datastore HOT 3
- How to provide factory default datastore for sysrepo-plugind module in order to configure the plugin order? HOT 2
- Candidate datastore is not always validated HOT 2
- Question regarding srsn_filter_subtree2xpath HOT 1
- redis tests when no redis server installed HOT 1
- Question regarding order of the elements of a list in the state HOT 4
- Default value for config=false leafs HOT 5
- netopeer2-server crashing while establish-push notification generated HOT 7
- sysrepoctl -l [ERR] Data model "sysrepo-monitoring@2023-08-11" not found in local searchdirs. [ERR] Loading "sysrepo-monitoring" module failed. sysrepoctl error: Failed to connect (libyang error) For more details you may try to increase the verbosity up to "-v3". HOT 15
- Memory leak when subscribing to notifications filtered by NACM HOT 2
- Missing changes in subscriber callback HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sysrepo.