Apache vs. LightHttp: função echo

Na versão em inglês do meu blog recebi um comentário estes dias que me deixou, “boiando”. No artigo sobre RSS onde eu apenas echoava o conteúdo do RSS usando a função “echo” do PHP. O usuário “BrokenToy” relata que teve alguns problemas utilizando a mesma solução no servidor Lighthttp, pois um “lixo” sempre aparecia no final do arquivo, evitando a validação do XML.

Até ai tudo bem, alguma imcompatibilidade estranha que ainda estou para estudar, mas depois ele relata uma forma diferente de jogar o conteudo na tela, usando “php://output”, e relatando que a função echo tinha diferenças de performance.

Fiquei com uma pulga na orelha e hoje pela manha esbarrei em um post que relata o mesmo. Tobias Schlitt relata um um post que entre o Apache e o Lighthttp existe uma diferença, pequena mas impactante, na performance do comando echo. Aparentemente um echo que demore 0.001 no Lighthttp, pode demorar 0.004 no Apache.

Comparação de Performance (Fonte: Tobias Schlitt)

Tobias relata que a única resposta que lhe pareceu válida sobre o assunto é o fato de o Lighthttp usar a memória compatilhada para transferência de dados, e o Apache “alguma outra coisa”. Bem a tese esta sendo discutida em listas de discussão, quem sabe em breve não teremos uma resposta concreta.

comments powered by Disqus

Related Posts

Day to Day of a Principal Engineer

Day to Day of a Principal Engineer

  • November 18, 2026

This past weekend I led a mentoring session at CodeCon Select with Damiana Costa. What sets CodeCon Select apart is its participatory formats, like mentoring, fishbowls, and AMAs, where the audience helps shape the talk. That makes for a much richer event, and I highly recommend it.

Read More
The Pitfalls of the Big Rewrite: Why Evolution Often Beats Revolution

The Pitfalls of the Big Rewrite: Why Evolution Often Beats Revolution

  • April 16, 2025

In many conversations about how products and systems evolve within companies, a recurring theme emerges: the pitfalls we encounter. One of the most significant is the pattern of the major rewrite, sometimes called “building off to the side.” Now, don’t get me wrong – a well-executed strangler pattern can lead to amazing transformations of codebases and products. However, embarking on a major rewrite can also be the first step towards building a company’s own tombstone.

Read More
Closing a chapter

Closing a chapter

  • September 1, 2024

This is it; the house is mostly empty as I sit in my temporary home office, the living room table. Our Dutch lives are mostly in boxes in a container, and the only things left to go are Bella, our retriever, and me.

Read More