Profiling Python web applications with visual tools

I have been profiling my software with KCachegrind for a long time now and I was missing this option when I am developing API’s or other web services. I always knew that this is possible but never really took the time and dive into it.

Before we begin there are some requirements. We will need to:

DeVos Halts Obama-Era Plan to Revamp Student Loan Management

The Obama administration sought to replace this labyrinthine system with a single entry point — a sea change in how student loan servicing would work. Instead of dealing directly with private vendors, all federal borrowers would gain access to their accounts through an Education Department portal, with standardized forms and processes. A single vendor would take the lead in creating the system’s interface

.. In October, the government narrowed the field to three finalists

  1. Navient; the Pennsylvania Higher Education Assistance Agency (better known as FedLoan);
  2. Nelnet
  3. Great Lakes

.. The winner was to be announced in February.

.. Navient is the biggest lightning rod. In January, the Consumer Financial Protection Bureau and two state attorneys general sued Navient, charging it with a long list of misdeeds.

.. a particular piece of guidance from the Obama administration she struck down:

  • that the Education Department should place great weight on a company’s track record when selecting student loan vendors, and should steer away from companies with histories of shoddy service or other problems.

.. that puts Navient — the nation’s largest federal student loan servicer ..

on stronger footing than it had been in bidding for agency contracts.

.. The Consumer Financial Protection Bureau responded ..

borrowers “should be able to repay their debt without having to deal with illegal loan servicing practices.”

.. Navient’s size makes it a very strong competitor — once past performance is played down.

.. The loan servicer has tremendous power to guide them through repayment options. Some plans stretch payment periods out for as long as 30 years, and others help qualifying students get a portion of their debt forgiven. Strategic use of those paths can trim — or inflate — the sum that a student ultimately pays by tens of thousands of dollars.

Electron is flash for the desktop

slack isn’t a native app. At least – not a normal native app. Its built on top of electron, so when you download slack you’re actually downloading a complete copy of Google Chrome.

.. And chrome is a hog. Its huge and complicated. It uses ram and CPU like nobody’s business, and it totally thrashes your battery life.

.. By lines of code, chrome is about the same size as the linux kernel. Like the linux kernel it has APIs for all sorts of hardware, including opengl, VR, MIDI. It has an embedded copy of SQLite, memory management and its own task manager.

.. Does slack contain my code to use xbox controllers? Does the slack team know?

.. The other electron apps I have on my computer are Spotify (200 megs) and Atom (260 megs).

..  Developers don’t let friends write electron apps. If you want to use JS and react to make a native app, try react native instead. Its like electron, but you don’t need to distribute a copy of chrome to all your users

.. Facebook has been internally intentionally slowing down their office internet once a week to help build empathy with their users in other 3rd world internet speed countries (coughAustraliacough).

Understanding CPU Steal Time – when should you be worried?

If we applied a CPU steal time-like metric to the ticketing process, it would look like this:

  • 0% Steal Time – it’s a Wednesday matinee: the ticket booth is picking a moviegoer from line 1, then line 2, then line 1, then line 2, and so on. No one is waiting.
  • 50% Steal Time – It’s Friday night: instead of being able to purchase a ticket immediately, half of the time a person in the line needs to wait for the person at the booth to complete their purchase. Things are taking longer.
  • 100% Steal Time – It’s a Friday night and the cash register is broken: no one is moving.

.. if steal time is greater than 10% for 20 minutes, the VM is likely in a state that it is running slower than it should.

When this happens:

  1. Shut down the instance and move it to another physical server
  2. If steal time remains high, increase the CPU resources
  3. If steal time remains high, contact your hosting provider. Your host may be overselling physical servers.