Internals of Exceptions – Adam Furmanek
unfortunately, I had to skip this as the cold I caught did not let me sleep so the first thing in the morning I went to the nearest pharmacy which was in the opposite direction of the conference.
Most Common Mistakes in Using Tasks and in Asynchronous Code – Jiri Cincura
Callbacks are hell => painful
CPU bound – Parallel.For, Task.Run
IO bound – async (real async code) – anything which is not CPU bound
Due to scalability – creating and destroying threads take resources. 1 mb per thread creation on stack.
Avoid tasks for simple operations – e.g . Task.Run(() => a + b) will be slower. Instead do Task.FromResult(a+b)
Task is reference type, ValueTask is on stack => can be easier to work with it
TaskCreationOptions.LongRunning – creates task and first await destroys it
Use a queue processor. Use IsBackgrond to true to close the thread after closing app => better than abusing tasks
Wait is blocking – waits for completion
Await jumps back here as soon as the operation is completed – continuations and coroutines
Sync over async, not a good idea – just use sync api directly
Use async await everywhere, don’t use obj.AsyncMethod.Result from sync code
Careful with Synchronization context
Async everywhere / all the way up the code, don’t mix async with sync methods
Use factory if you need async in constructor
Async void is bad as the caller has nothing from the called method
Beware of blocking
Don’t cache the task itself
Overall impression: good content, good examples
Debugging Asynchronous Scenarios in .NET – Christophe Nasarre, Kevin Gosse
Thread pronounced as fret again 🙂
ActionBlock .NET implementation of producer/consumer
ActionBlock.Complete() – stop getting new things, finish processing what it began
Use memory window visual studio to get address of specific object, find it in windbg
Sosex (SOS Ex not So SEX) extension for windbg
Find instances of ActionBlock to understand what happened
Windbg cmd – printexception
debug session with windbg
Overall impression: awesome session, hands on debugging, I hope I can get the recording though
Lunch Break – Highlight of the whole conference for me
As I wondered around the hall after I ate, I went to find some hot water so I can prepare my Coldrex drink to fight the cold I caught. I went by a table where there were several participants chatting + another guy, who was not engaged in the group, was more “isolated” at the table. I think that this guy had just taken one a available seat at a partially occupied table. This guy was heavily texting on his smartphone.
This guy, seemed very familiar, but from where? Then it hit me, it was Jeffrey Snover, father of PowerShell. At first I could not believe it, performed a google search and double checked. It was him! I was like OMFG :). He just stood there at the table, texting, while all other participants were too engaged in chit chat that they hadn’t noticed who joined their table (bummer for them, yay for me :D).
What to do? I wanted to meet him, but there I was with a cup of hot Coldrex to fight the cold. I decided to drink it ASAP and do something. It was too hot, went to the water cooler, added some cold water, drank a bit, added some more cold water until it was safe to drink. Bottoms up and I was back at the table in like under 2 minutes.
Mr. Snover was still busy on his smartphone. I asked if the seat next to him was taken and if I could join the table. The participants group responded that I can join, the seat was available (see setup below).
Table setup
I waited for a while for Mr. Snover to finish, as I didn’t want to be rude and interrupt his work there.
After a few minutes, the conference big raffle started, lots of talking, prizes etc. Then, Mr. Snover put his phone down. Just my luck, it was noisy but went for it :). I introduced myself and politely asked if he could provide some career advice. He was very open to help.
We talked for several minutes and I managed to further ask for a list of the most influential books he ever read. I received a list of three books (technical, business, leadership), which I’m willing to share with you => just contact me and I’ll share the titles. I want to see how many people are really interested in this.
Needless to say, I was honored to meet the father of PowerShell and get advice from him. This was the highlight of the conference for me! The final keynote he delivered was like a sequel to the conversation we just had, it “clicked”. Keep reading, I have highlights from the closing keynote as well.
Turbocharged: Writing High Performance C# and .NET Code – Steve Gordon
Performance is contextual
Performance and readability compromise – take into consideration based on how many people maintain the code and how often
We need measurements – optimization cycle – use realistic scenarios – start with worst performers
Optimize and measure again to prove that the change is faster
App performance measure
Visual studio diagnostic tools – debugging
visual studio profiling / PerfView / dotTrace / dotMemory
Ilspy / just decompile / dot peek
Monitor production metrics and monitoring
Benchmark code with Benchmark .NET – library for net micro benchmarking – available via nuget
High precision
Extra data available
Compare performance on different platforms, architectures, jit versions and gc modes
Similar with unit test, add attributes eg MemoryDiagnoser
Get summary of execution in nanoseconds
See in what generation in heap do they live for before going in next gen for gc
Span<t>
Cannot be sent as param, can use Memory<t> and access span from there
Original code ~ 1 page length vs optimized code ~ 4-5 page length – maybe more => optimized code is ugly 🙂
Overall impression: good content, good explanations
What Every Developer Should Know About SQL Server Performance – David Berry
Find the slow query (think of orm)
Log sql query from ef
Miniprofiler
Dynamic management views
Sql server profiling
If query is slow, get execution plan of query
Lifecycle of sql statement: parse, query optimization, execution phase
Explore execution plan: button from SQL Management Studio => look at cost to compare multiple statements
Compare with other statements from system to check which ones are slow
Exec plan is read from right to left
Green text helps us with contextual advice (eg missing index)
SQL saves data in a tree structure
How SQL uses indexes
Another tree structure organised by another criteria (eg id)
Create index significantly improves query perf (costs)
This guy had an interesting twist, instead of aaaa hhhmmm at the end of a sentence he produced a sound similar with snoring, I thought there was somebody snoring behind me at first 🙂
Enable these via SQL commands
Set statistics io on – show more data regarding queries
Set statistics time on – show ms required to parse, compile, and execute statements
Look for scan operations => as that implies you are not using data efficiently
Clustered index scan = reads all table
First columns of table should appear most frequently in where clauses and should me made into indexes
Index selectivity – if index is not unique, performance is poor. Eg have index on email address instead of sex (m/f, status codes)
Create indexes on foreign keys and search columns is a good idea. The primary key is indexed by SQL server by default => great start with only these
Dynamic management views
Queries available on github
An index is costly, more indexes = more cost. We need to keep a balance on the maintenance cost for an index
Index usage statistics – candidates to be removed after investigating why they were created
SQL tracing
SQL profiler is obsolete and affects your system
Use Extended events – ETW (Event Tracing for Windows) based are the new way to investigate – from SQL management studio – create new session from UI, choose a template, apply filters for narrowing results
Performance best practices
Test with a production size
Keep SQL statements focused
Single Responsibility Principle applies to queries too, always leads to bad performance when querying too many things at once – d’oh
Overall impression: a nice refresh with some more additions regarding how SQL server works and how to make queries faster. Very good content, enjoyed it
Closing Keynote: M365: The People OS for Your Organization – Jeffrey Snover
Ship frequent – it would wait until sp1, 1 year, next version etc before installing it to organizations. Fast delivery solves this issue
Focus of Microsoft: Azure and Office 365
10x amplification => reference to The 10x Rule book?
Microsoft pushes new versions to everyone as is easier to maintain => previously this did not happen => referred as broken ecosystem due to multiple versions they needed to maintain
M365 – the people OS
based on integrations => brings value to customers, helps them being successful, this can be monetized. For every dollar which goes to Microsoft, partners earn 10. Create dependencies on integrations to keep users focused and in their ecosystem.
MS Graph – common api that brings all together. Resource oriented graph, rest. Uses odata
Give awkward name so people don’t understand as this gives the opportunity to explain and avoids assumptions – Microsoft Substrate
Teams has a feature to transcribe audio and save it to substrate
Mechanism to add other apps mandatory to any os (plus some default tools)
M365 protects resources of the people – users, docs, messages, calendars
Virtual water cooler (discussions) – discover recent files of others
Microsoft mission is to help others achieve more
Overall impression: Pretty cool, even though it was a marketing presentation, it made sense and it also “clicked” with my previous discussion with Mr. Snover.
And this was the conference! I hope you enjoyed the summaries, it took some time to put them together :). Really hoping to go to this conference or others next year!
Comments