microsoft / durabletask-mssql

Microsoft SQL storage provider for Durable Functions and the Durable Task Framework
MIT License
87 stars 32 forks source link

Possible to remove Microsoft.SqlServer.SqlManagementObjects dependency? #91

Closed IGx89 closed 2 years ago

IGx89 commented 2 years ago

Hello! I noticed today that my function app's size increased from 13 MB to 35 MB after adding a dependency on this project. Curious about why the size jumped so much, I discovered the main culprit is this project's dependency on Microsoft.SqlServer.SqlManagementObjects. Digging into it further, I discovered that this dependency is only used for a small piece of code in SqlDbManager that runs a SQL script. That code has a link to a SO article that was the inspiration for adding this dependency to begin with. However, on the same SO article, there are also solutions that don't require this dependency (such as this one).

I'm unsure how feasible the alternatives actually are (though making the change locally at least didn't increase the number of failing tests for me :p) so apologies if this is completely unhelpful, but wanted to at least bring it up in case it could be a quick win.

cgillum commented 2 years ago

Thanks for bringing this to my attention! Wow, yes, I agree it might be worth it to ditch this dependency if we can save 20+ MB. The size matters, especially in terms of cold-start impact for apps. It's definitely not worth having around just to execute a SQL script.

You mentioned you have this working locally...would you be willing to submit a PR with the change? Otherwise, I can look into this when I have some cycles.

IGx89 commented 2 years ago

I'm up for giving it a try! Need to figure out why 6 unit tests are failing for me on a clean repo first. Whoever gets to it first :). Actual savings I'm guessing will be more like 10 MB (uncompressed) due to my current function app not having a dependency on Microsoft.Data.SqlClient at all -- I know that adds a few unavoidable megabytes.