A few weeks back I posted on Twitter that I was experimenting with flame graphs, In this post I will share how this was accomplished.
[Read More]flame on
Posted on May 29, 2016 | 3 min | 500 words
A few weeks back I posted on Twitter that I was experimenting with flame graphs, In this post I will share how this was accomplished.
[Read More]In this edition we are going to be doing a taste test, C# vs F#. Oh yeah, if you quickly glanced at the title you may have thought this was a recipe for black scones, as interesting and tasty as that may be, unfortunately its going to be finance related.
I recently presented a paper on the benefits of F#, part of this was a comparison of the famous Black-Scholes equation in both C# and F#. I was mainly going to be looking at code succinctness and the inherent suitability of the language for calculation based work, but there ended up being more to it than that.
[Read More]Due to popular demand… well, I had a couple of requests anyway :-) Heres a post inspired by my recent encounters profiling some of the code in Fracture-IO. I have recently been profiling the code in fracture to remove any so called low hanging fruits. During this time I also noticed an increase in memory allocation. I remembered I had recently been experimenting in a branch using pipelets as a buffer between the send and receive stages in the Http Server, so I set up a simple test to see if pipelets were contributing to the memory allocation issues I was seeing. Here’s the simple iteration test code I used for the memory profiling:
[Read More]Everyone knows F# agents are cool right? Well here’s yet another example of how versatile they can be…
There was a series of posts last April by Stephen Toub from the pfxteam at Microsoft. I was reading through some of the posts again the other day and thought some of the ideas presented there would make interesting projects in F# to demonstrate the flexibility and succinctness of the language. I thought the ObjectPool example would make an interesting project in F# using agents aka MailboxProcessors. An ObjectPool is basically a pool of objects that have been pre-created so that you can grab one and use it, and then place it back in the pool when you’re finished. They are useful in situations where the cost of creating object from scratch is very high or you want to cut down on allocations in the garbage collector.
[Read More]If you were looking forward to some exciting new F# code this time your going to be disappointed, however if you are like me and like looking at graphs and stats and digging in deeper into the code then your going to enjoy this, lets get started…
I set up a 5 minute test with 50 clients connecting to the server with a 15ms interval between each one. Once connected each client receives a 128 byte message from the server every 100ms so this will be a 500 messages per second test. I am going to be using an excellent product called YourKit Profilerfor .NET it can do both memory and CPU profiling as well as displaying telemetry for things like thread count, stack contents, memory allocations etc. It can be configured to be a lot less intrusive than a lot of other profilers and I have had a lot of success using it. You can download a demo from their site using the link above. I will be doing some other articles on using profiling and analysis tools later on so stay tuned for those too. All of the graphs and information gathered in this post come from YourKits output during CPU and memory profiling.
[Read More]As promised heres a description of the inner workings. I’m sick to death of typing SocketAsyncEventArgs so from now on I will refer to it as SAEA.
BocketPool
The BocketPool has an interesting name and with it an interesting constructor!
It takes the following parameters:
number: The number of items to create in the BocketPool. size: The size of each buffer in bytes. callback: A callback function which is invoked whenever the SAEA object completes its operation.
[Read More]Lets jump in at the deep end and take a look at some code…
When you look at the method syntax for the xxxAsync methods you will notice they return a boolean value that indicates if the method completed synchronously, this means that you have to check the return value every time you use one of the methods and invoke the callback yourself if it completes synchronously. In practice this hardly ever happens, and normally only on a send operation. But as it is a possibility we will add module with a some extension methods in to help us out, this will make the code more readable and avoid unnecessary duplication.
[Read More]A while back I read an interesting article by Brian McNamara f-async-on-the-server-side which describes C# and F# versions of a simple asynchronous socket server, one of the driving forces behind the article was how F# can wrap the traditional asynchronous model with Asynchronous Workflows, this produces nice clean simple code compared to the C# version which uses lambda expressions, the code looks quite ugly in this style! However thats not the end of the story, a lot of memory fragmentation can occur using the APM model when there is a high throughput, so I thought I would see if I could take this a step further…
[Read More]