Category: Optimization

  • Improving the performance of slow Entity Framework queries

    I’m a big fan of Entity Framework. It makes working with databases very convenient. I’ve discussed previously how I use Entity Framework to implement the repository pattern. Of course with ease of development sometimes sacrifices performance. In today’s article I’m going to explain my favorite approach to improve the performance of Entity Framework queries that are slow.

    (more…)

  • Setting up SSL with nginx including redirects from non HTTPS traffic

    In an attempt to improve security and privacy on the Internet, Google is encouraging websites to secure their site with an SSL certificate, aka https:// instead of http://
    As you may have noticed, I just officially updated my domain to be under SSL. As I described in my It’s LEMP not LAMP post that I use nginx for my web server. I thought I would share how easily I was able to convert my website to use SSL with nginx.

    Before you begin, be sure you have already created your SSL certificate and have your certificate and private key files ready and uploaded to your server (I got my SSL cert free with my domain registration at Porkbun).

    (more…)

  • C# OutputCache with subdomains

    The other day I was working on a project that was leveraging OutputCache. This little attribute is a fantastic way to implement caching in an MVC project. This was working great until I encountered a snag when using a subdomain.

    (more…)

  • MySQL: OR versus UNION – which is faster?

    I must say, this came as a shock to me, until I looked at the results and thought about it for a minute.  Before jumping in, let me explain how and where I encountered this.  I was recently working on a project called Deja Scene – The actor to actor movie database.  The purpose of this site is to find two actors who have starred in multiple movies together.

    Because the nature of the algorithm an actor can be either on the left side of the connection or the right side.

    Let’s look at an example, if I search for George Clooney, I will find that he has 372 Deja Scene connections.  Here was the original query I used to retrieve the list of his connections:

    [code]
    SELECT *
    FROM  `actor2_actors`
    WHERE actor1_id =1
    OR actor2_id =1
    [/code]

    Seems pretty straight forward; however, I was seeing really slow performance and I couldn’t figure out why.  I created an index on both the actor1_id and the actor2_id, so I assumed Mysql was properly indexing this.  Boy was I wrong.  Look at the results when I use the EXPLAIN function:

    (more…)

  • Three-month work-life retrospective

    Just over three months ago, I posted a few memorable blogs (for me) in regards to a career change.  The career change has been made and I thought I would share my retrospective on how it has affected me.

    Following the format of the retrospectives I have been over the past 3 months, I’ll start with a check in word:

    Rejuvenated

    Making the move from an 85% managerial role to a 100% development role has completely rejuvenated me.  In the past three months I have gained an incredible amount of knowledge and furthered myself as a person and a developer.

    Moving along to the next items:

    • What do I want to stop doing?
    • What do I want to start doing?
    • What do I want to continue doing?

    (more…)