Wednesday, April 18, 2018

Python / Flask Performance Profiling

I've recently been doing work on some python flask web applications my team owns at work. Twice now, I've needed to acquire profiling data to help pinpoint where issues were stemming from within the code and dependencies.

In lieu of not trying to track down what I've learned / researched twice now, I'm recording my methods and tools here for future reference. Hopefully others will be able to make use of this information as well!

I've created a small and simple python flask-based webapp which makes use of Werkzeug's ProfilerMiddleware and SnakeViz to visualize a request - you can find this example and the quickstart on GitHub. After 7 quick steps, you'll be presented with something similar to below:

Generating profiling data

  • http://werkzeug.pocoo.org/docs/0.14/contrib/profiler/

Viewing profiling data

  • https://jiffyclub.github.io/snakeviz/
  • https://kcachegrind.github.io/html/Home.html

Monday, August 14, 2017

pfSense Boot Issue after upgrade to 2.4.0-BETA

I was really excited to start using the Telegraf plugin for pfSense, but it was only part of pfSense 2.4.0, where I was running 2.3.4 for my home network.

After talking with some of the pfSense / Netgate folks, they assured me that 2.4.0-BETA was stable enough that I should be able to upgrade without any issue.

I did have one slight issue.

For whatever reason, upon updating, it seems that my hard drives became mapped to a different drive.

Before the upgrade, /etc/fstab showed:

Upon boot, I was greeted with the wonderful:

In order to fix this permanently, it was as simple as updating the /etc/fstab file to be as follows:

I'm unsure if some driver changed or what would have caused this; I did try switching the drive from Legacy to AHCI and back again in the BIOS, but that still didn't yield success. In the end, I just needed to modify the /etc/fstab file, and I was back in business.