[PATCH] Speeding up samba-tool execution

Garming Sam garming at catalyst.net.nz
Sun Jul 17 22:26:09 UTC 2016

I have fixed the issue (a one-line change) and attached the patch.

What I observed was that on system_exit, the code would segfault
(although this would still pass the tests). What was happening was that
the talloc_enable_null_tracking was being enabled part-way through
execution, this was done implicitly through the import of join.py
(through one of the subcommands). By splitting it out, the
enable_null_tracking would be conditionally enabled and therefore, start
to cause issues.

I've simply removed the enable_null_tracking, as it was only there for
debugging purposes (if anyone has any major reasons for instead moving
this to the top level bin/samba-tool script, please raise them). This
should now pass all the samba-tool tests in make test.

Please review and push.



On 15/07/16 17:07, Garming Sam wrote:
> I've written an updated patch as the original didn't take into account
> some of the ways the test code used the samba_tool class, however the
> dynamic nature seems to have caused some memory allocation issues
> (possibly existing issues). So unfortunately, I'm still working on this.
> Cheers,
> Garming
> On 15/07/16 14:48, Garming Sam wrote:
>> Hi,
>> For a while now, the docs.py has been one of the longest running tests
>> in autobuild. After a lot of aimless poking, I've finally found one the
>> major reasons that this is the case.
>> Samba-tool as a whole, takes a very long time to start up. This isn't
>> entirely the fault of python however, nor is it because of the top level
>> samba module import. What I've found is that pre-load of each samba-tool
>> subcommand (e.g. testparm, dbcheck, user etc.) and the imports included
>> in the subcommands massively slow down the overall tool. Besides the
>> subcommand you're actually trying to run, there's no reason to load any
>> of the other subcommands so I've written a patch to load the subcommand
>> on the fly. This seems to suggest a 10x performance improvement with
>> some basic testing (and for testparm specifically, it's now within
>> striking distance of the original C code).
>> This change should make every call to samba-tool noticeably faster and
>> more responsive, which is excellent.
>> Feel free to review and push (otherwise it will probably get rolled into
>> the next time I do an autobuild).
>> Cheers,
>> Garming

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-pytalloc-Add-a-warning-about-enable_null_tracking.patch
Type: text/x-diff
Size: 1599 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160718/0e670260/0001-pytalloc-Add-a-warning-about-enable_null_tracking.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-samba-tool-Speed-up-all-samba-tool-commands.patch
Type: text/x-diff
Size: 3954 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160718/0e670260/0002-samba-tool-Speed-up-all-samba-tool-commands.diff>

More information about the samba-technical mailing list