Azure Functions vs AWS Lambda – Scaling Face Off

The results are, frankly, pretty damning when it comes to Azure Functions ability to scale dynamically and so let’s get into the data and then look at why.

.. I don’t think there’s much point dancing around the issue: the above numbers are disappointing. Azure is slow to scale it’s HTTP triggered functions and once we get beyond the 100 concurrent users point the response times are never great and the experience is generally uneven. For customer facing API / web serving where low latency and response time are critical to a smooth user experience this really rules it out as an option.

Hillary Clinton meets Mary Beard: ‘I would love to have told Trump: “Back off, you creep”’

when Trump was stalking me [in the 2016 televised presidential debates] and leering and, oh, just generally trying to dominate me on this little stage, my mind was like: OK, I practised being calm and composed, you know, because that’s what a president should be. But, boy, would I love to turn around and say: “Back off, you creep.” But I didn’t, because I thought then his side will say: “See, she can’t take it. If she can’t take Donald standing there like the alpha male that he is, then how’s she going to stand up to Putin?” A ridiculous argument, but nevertheless one that might get traction. And, as you say, even your friends are like: “Oh, come on, don’t take the bait. Don’t take the bait.”

.. Being an academic gives you a bit of freedom to play around with things, because in the end what people think about me doesn’t matter all that much. But I remember when I first did telly, a clever, nasty but well-respected TV critic here said, basically: “You look like the back end of a bus. How dare you come into our living room with those teeth? If you’re going to inflict yourself on us, please will you smarten up.” After the first shock, I thought, look, sunshine, if you line up a load of women between 55 and 65, they’ll mostly look like me. So, I wrote a piece pointing out that he was not abusing me only, he was abusing every woman who looked a bit like me.

HC I think you touched a chord when you said: “OK, this is what a woman looks like.” When you run for office, however, what a president looks like is not any kind of woman. So therefore how you feel about this particular woman is influenced by how you feel about women in really powerful positions

.. MB When I looked back to the ancient world about this, Romans in particular were always saying that women, in some way, are fake. The problem about a woman is that she’s always made up, she’s never what she seems. 

.. HC Men can get a haircut; it doesn’t change their authenticity. They can grow a beard; they are still who they are. Whereas we are constantly held to that good old double standard, which is so complex and deep and charged with historical and mythological and cultural totems.

.. MB Your book has turned me yet more against presidential debates. I mean, what did I learn from the debates? I learned absolutely nothing that I didn’t think I knew already. I knew that Trump was ghastly. I knew I’d vote for Hillary if I had a vote. So to say: “I don’t think we’ll have a debate this year,” seems antidemocratic. But democracy has to think a bit harder about the dissemination of knowledge.

.. HC Part of the reason I prepared [for them], and part of the reason I had such an extensive, substantive policy portfolio, is that there have been, in the past, moments of reckoning, where a smart moderator will really pin you down: “OK, you say you want to do this on taxes – what will be the impact on economic growth?” I mean, something that’s a little more sophisticated and really does require you to be on your toes. But that didn’t happen this time at all.

..  And the Greeks would have seen this. Democracy requires information. Plato knew that informed decision-making requires knowledge.

.. There is a deliberate, very well‑organised, sophisticated assault on facts and reason and evidence. In our country, it’s driven originally by a cabal of billionaires and religious fundamentalists, and their view is that it doesn’t matter what they say. If they say it often enough and they put enough money behind it, they’ll convince a significant number of people.

.. But you’re in a double bind, as a historian or a politician or any job where expertise is required. You don’t want to say: “Only politicians are allowed to talk about foreign policy.” You want to share and debate with people who’ve got different opinions, of course you do – but actually you sometimes need to have read something about it.

.. HC .. I wanted to ask you about that memorable debate you had with Boris Johnson over Greece versus Rome. He is a reality TV kind of character from my observation, don’t you think?

MB Yes!

HC And he knows it and he knows how to play it. It’s very deliberate. The same with Trump. I mean, it’s a persona that they have assumed, which really works for them, even the same kind of hair. The hair is part of the whole deal.

MB And it is so contrived, and it is contrived to look so spontaneous, it makes you sick.

.. HC It’s interesting, because men’s roles in public life are somewhat evolving. It used to be: you go for the sober character on the right or the left, who you think represents your views and whose platform you support. They could come in different sizes and shapes, but there was an assumption they were serious people, even if they had a good sense of humour, right?

Now, because of what I think is the pressure of performance, which is more important than substance by a long shot, it is the performance that matters most. We’re going to see more of this type. And I think then it’s particularly hard to pin down and make the argument about position and facts versus performance and rhetoric.

MB When I debated with Boris about Greece versus Rome, it was a fun charity gig, but it revealed precisely that. Boris is very funny. He can work an audience. I admire it. I knew the only way I was going to have a chance of winning was by being fantastically prepared.

HC That sounds very familiar. [Laughter.]

 

.. MB It’s back to the old version that was prevalent at university when I was an undergraduate – you know, that it was the women who were in on the Saturday nights doing the work, and they were very diligent, but they didn’t really have that…

HC They didn’t have the creative…

MB The flair. So, they were awfully reliable – and by awfully reliable, you mean very boring. Whereas, somehow, what both Boris and Trump have done is they’ve branded themselves around gaffes, so that it no longer makes a difference. One extra gaffe doesn’t matter, because that’s the brand.

HC Women are going to have to learn how to pull off that trick. I think it’s difficult, but it has to be possible, because there’s no alternative.

AWS Summit: Scaling Up to Your First 10 Million Users

Cloud computing gives you a number of advantages, such as the ability to scale your web application or website on demand. If you have a new web application and want to use cloud computing, you might be asking yourself, “Where do I start?” Join us in this session to understand best practices for scaling your resources from zero to millions of users. We show you how to best combine different AWS services, how to make smarter decisions for architecting your application, and how to scale your infrastructure in the cloud.

Five ways to paginate in Postgres, from the basic to the exotic

However the PostgreSQL statistics collector maintains per-column histograms of value distribution. We can use these estimates in conjunction with limits and small offsets to get fast random-access pagination through a hybrid approach.

First let’s look at the statistics of our medley:

<span class="k">SELECT</span><span style="color: #dddddd;"> <span class="n">array_length</span><span class="p">(</span><span class="n">histogram_bounds</span><span class="p">,</span> </span><span class="mi">1</span><span style="color: #dddddd;"><span class="p">)</span> </span><span class="o">-</span> <span class="mi">1</span>
  <span class="k">FROM</span><span style="color: #dddddd;"> <span class="n">pg_stats</span></span>
 <span class="k">WHERE</span><span style="color: #dddddd;"> <span class="n">tablename</span> </span><span class="o">=</span> <span class="s1">'medley'</span>
   <span class="k">AND</span><span style="color: #dddddd;"> <span class="n">attname</span> </span><span class="o">=</span> <span class="s1">'n'</span><span class="p"><span style="color: #dddddd;">;</span></span>

In my database the column n has 101 bound-markers, i.e. 100 ranges between bound-markers. The particular values aren’t too surprising because my data is uniformly distributed

<span class="p"><span style="color: #dddddd;">{</span></span><span class="mi">719</span><span class="p"><span style="color: #dddddd;">,</span></span><span class="mi">103188</span><span class="p"><span style="color: #dddddd;">,</span></span><span class="mi">193973</span><span class="p"><span style="color: #dddddd;">,</span></span><span class="mi">288794</span><span class="p"><span style="color: #dddddd;">,</span></span> <span class="err">…</span> <span class="p"><span style="color: #dddddd;">,</span></span><span class="mi">9690475</span><span class="p"><span style="color: #dddddd;">,</span></span><span class="mi">9791775</span><span class="p"><span style="color: #dddddd;">,</span></span><span class="mi">9905770</span><span class="p"><span style="color: #dddddd;">,</span></span><span class="mi">9999847</span><span class="p"><span style="color: #dddddd;">}</span></span>

Notice that the values are approximate. The first number is not exactly zero, and the last is not exactly ten million. The ranges divide our information into a block size B = 10,000,000 / 100 = 100,000 rows.

We can use the histogram ranges from the PostgreSQL stats collector to obtain probabilistically correct pages. If we choose a client-side page width of W how do we request the ith page? It will reside in block iW / B, at offset iW % B.

Choosing W=20 let’s request page 270,000 from the medley table. Note that PostgreSQL arrays are one-based so we have to adjust the values in the array lookups:

<span class="k">WITH</span><span style="color: #dddddd;"> <span class="n">bookmark</span> </span><span class="k">AS</span><span style="color: #dddddd;"> <span class="p">(</span></span>
    <span class="k">SELECT</span><span style="color: #dddddd;"> <span class="p">(</span><span class="n">histogram_bounds</span><span class="p">::</span><span class="n">text</span><span class="p">::</span><span class="n">int</span><span class="p">[])[((</span></span><span class="mi">270000</span> <span class="o">*</span> <span class="mi">20</span><span style="color: #dddddd;"><span class="p">)</span> </span><span class="o">/</span> <span class="mi">100000</span><span class="p"><span style="color: #dddddd;">)</span></span><span class="o">+</span><span class="mi">1</span><span style="color: #dddddd;"><span class="p">]</span> </span><span class="k">AS</span> <span class="k">start</span><span class="p"><span style="color: #dddddd;">,</span></span>
<span style="color: #dddddd;">           <span class="p">(</span><span class="n">histogram_bounds</span><span class="p">::</span><span class="n">text</span><span class="p">::</span><span class="n">int</span><span class="p">[])[((</span></span><span class="mi">270000</span> <span class="o">*</span> <span class="mi">20</span><span style="color: #dddddd;"><span class="p">)</span> </span><span class="o">/</span> <span class="mi">100000</span><span class="p"><span style="color: #dddddd;">)</span></span><span class="o">+</span><span class="mi">2</span><span style="color: #dddddd;"><span class="p">]</span> </span><span class="k">AS</span><span style="color: #dddddd;"> <span class="n">stop</span></span>
    <span class="k">FROM</span><span style="color: #dddddd;"> <span class="n">pg_stats</span></span>
    <span class="k">WHERE</span><span style="color: #dddddd;"> <span class="n">tablename</span> </span><span class="o">=</span> <span class="s1">'medley'</span>
    <span class="k">AND</span><span style="color: #dddddd;"> <span class="n">attname</span> </span><span class="o">=</span> <span class="s1">'n'</span>
    <span class="k">LIMIT</span> <span class="mi">1</span>
<span style="color: #dddddd;">  <span class="p">)</span></span>
<span class="k">SELECT</span> <span class="o">*</span>
<span class="k">FROM</span><span style="color: #dddddd;"> <span class="n">medley</span></span>
<span class="k">WHERE</span><span style="color: #dddddd;"> <span class="n">n</span> </span><span class="o">>=</span><span style="color: #dddddd;"> <span class="p">(</span></span><span class="k">select</span> <span class="k">start</span> <span class="k">from</span><span style="color: #dddddd;"> <span class="n">bookmark</span><span class="p">)</span></span>
<span class="k">AND</span><span style="color: #dddddd;"> <span class="n">n</span> </span><span class="o"><</span><span style="color: #dddddd;"> <span class="p">(</span></span><span class="k">select</span><span style="color: #dddddd;"> <span class="n">stop</span> </span><span class="k">from</span><span style="color: #dddddd;"> <span class="n">bookmark</span><span class="p">)</span></span>
<span class="k">ORDER</span> <span class="k">BY</span><span style="color: #dddddd;"> <span class="n">n</span> </span><span class="k">ASC</span>
<span class="k">LIMIT</span> <span class="mi">20</span>
<span class="k">OFFSET</span><span style="color: #dddddd;"> <span class="p">((</span></span><span class="mi">270000</span> <span class="o">*</span> <span class="mi">20</span><span style="color: #dddddd;"><span class="p">)</span> </span><span class="o">%</span> <span class="mi">100000</span><span class="p"><span style="color: #dddddd;">);</span></span>

This performs blazingly fast (notice the offset happens to be zero here). It gives back rows with n = 5407259 through 5407278. The true values on page 270000 are n = 5400001 through 5400020. The values is off by 7239, or about 0.1%.