Armazenamento em nuvem como uma opção CDN

Se você assinar um serviço de um link nesta página, a Reeves and Sons Limited pode ganhar uma comissão. Veja nosso Declaração de ética.

Se você tiver um site lento, provavelmente em um servidor compartilhado que recebe muito tráfego, poderá acelerar um pouco hospedando parte de seu conteúdo em uma Content Delivery Network (CDN).

Unfortunately traditional CDN is often priced out of reach for a small business website, but the good news is there is a way to set up cloud storage drives to act as your own personal CDN systems. In this article we’ll discover some methods for doing that.

Emulação CDN de armazenamento em nuvem vs. CDN puro

The main difference is cost and volume. Pure CDN usually works out cheaper for high traffic volumes and more expensive for low traffic volumes. Because a typical small business isn’t likely to see the kind of traffic that would make pure CDN worth it, emulating CDN functionality with cloud storage is generally a more affordable and simple solution.

Escolhendo um provedor de armazenamento em nuvem

Usar o armazenamento em nuvem para CDN requer que você possadividual files available for direct public access, so this rules out zero-knowledge encryption services, because they’re not designed for general public access.

Second, you don’t want a provider that puts limits on resource access, or at least the limits should not be too strict.

Distribuindo o conteúdo que você deseja receber por

There are then different options depending on what kind of content you’re hosting. If you’re wanting to host specialist content, for example video, music, or other artistic works, checking out DECENT would be a good idea.

DECENT é uma rede de distribuição de conteúdo descentralizada baseada em blockchain altamente especializada. Ele permite que você publique algo sem dependência de um intermediário.

Utilizando conexões peer-to-peer, o tráfego DECENT é muito difícil de interromper ou bloquear, o que também torna potencialmente capaz de contornar a censura. Está mais orientado para transações comerciais e a tecnologia blockchain torna essas transações fáceis de serem protegidas.

What it’s not very good for is distributing ordinary files like JavaScript, CSS, and XML files. For that, you’ll need a more regular cloud storage provider. The two biggest players in this field are Google and Amazon. Both are giants, but there are considerable differences between them.

Uma comparação rápida: Amazon vs Google

Amazon comes in two flavors: Amazon S3 and Amazon Drive. The Amazon S3 system is an enterprise level system with all the complexity that you’d expect from such a system. It’s designed for big websites that get a lot of traffic, and the pricing structure is really complicated.

Você pode nunca precisar se preocupar com os preços, no entanto, se suas necessidades são razoavelmente modestas. O Amazon S3 oferece uma oferta gratuita com 5GB de armazenamento, solicitações de pedidos 20k e solicitações de colocação 2k.

The problem here is that many of those get requests are not coming from humans, but from robots, so you can quickly burn through 20,000 requests before the month is up if your site is good at attracting robots. When your site does go over the limits, it doesn’t get suspended. You just have to pay up.

Amazon Drive is like Amazon S3 with training wheels. It comes with a much easier to use interface, requiring less technical ability. There’s a subclass called Prime Photos where you can get unlimited photo storage, and 5GB of storage for videos and other files, but it’s only free if you subscribe to Amazon Prime. The next step up provides 100GB of storage for $11.99 per year, and for $59.99 per year you can get 1TB of storage.

The standout thing here is the pricing is much simpler than Amazon S3. You know upfront what you get and what you’re expected to pay for it. It’s not really intended for using as a CDN, but it’s still possible to do it.

If you’re a WordPress user, you may prefer to use Amazon S3 because there are tools especially designed to help you do that through Amazon CloudFront. The complexity of setting that up is going to be beyond the scope of this article, so look for a dedicated article on exactly that topic coming up soon.

Google also has two options available: Google Cloud Storage and Google Drive. If you’re a Gmail user, you already have Google Drive.

O Google Cloud Storage destina-se ao uso em nível corporativo e, como tal, requer certa habilidade técnica para configurá-lo e ajustá-lo. O Google Drive é de nível de consumidor, mas muito fácil de usar com sua interface da Web simples.

O Google Drive começa com um generoso 15GB de armazenamento gratuito, o que é muito mais do que a maioria dos sites médios de pequenas empresas precisará. Se você achar que precisa de mais, você pode atualizar para:

All is not as it seems with these storage limits, however. Google Docs, photos other than full resolution (if stored using Google Photos), and any files shared with you by someone else don’t count toward your storage limit. Unfortunately emails (and attachments) do take up space if you’re actively using the Gmail account.

Para ter uma ideia de quanto você pode armazenar em 15GB, são aproximadamente 30 para 40 (m4v / mp4) em 1080 x 720 e duração de 90 minutos, ou sobre fotos 88,235 em 800 x 600 e otimizadas para a web. Seria incomum que a pequena empresa média precisasse tanto desse site.

O Google Drive é muito mais barato que o Amazon Drive. Em termos de desempenho, a Amazon pode ter um pouco de vantagem e a documentação com a Amazon é melhor. Cabeça a cabeça, o Google está oferecendo melhor valor geral.

Qual você deve escolher? Depende se você considera o desempenho mais importante do que o custo.

Hospedando imagens, CSS e JavaScript do Google Drive

Isso não é muito mais complicado do que hospedar vídeo. Na verdade, pode até ser mais fácil. Aqui está o que você precisa fazer:

1. No seu Google Drive, crie uma pasta especial que armazene os arquivos

2. Verifique se o nome que você dá ajuda a se destacar de outras pastas de unidade

3. Carregar todos os arquivos para essa pasta (você também pode criar subpastas)

4. Selecione a pasta que será compartilhada e clique no botão de compartilhamento

5. Quando a caixa de diálogo de compartilhamento for exibida, selecione "Avançado"

6. Na caixa de diálogo Configurações de compartilhamento mais avançada, selecione “Alterar”

7. Agora altere a configuração para “Ativado - Público na Web”

8. Você precisará repetir o processo acima para cada emdiviarquivo duplo também

9. Copie o link para cada recurso e cole em um editor de texto

10. Excluir tudo, exceto o id do arquivo

11. Agora adicione o texto “https://drive.google.com/uc?export=view&” na frente do ID do arquivo

12. Agora você pode modificar seu HTML. Para CSS:

Para JS:

Para uma imagem:

13. Faça o upload de uma versão de teste do arquivo HTML e faça um teste de velocidade em relação ao arquivo original

Original:

Versão de teste atualizada com o CDN do Google Drive:

Algo muito importante que você precisa notar aqui é que com o CDN habilitado, o desempenho foi realmente degradado. Isso aconteceu porque meu próprio servidor da Web comprime tudo automaticamente, mas os recursos transferidos para o Google Drive não são compactados automaticamente.

That’s a topic for another day, but the real lesson here is that CDN isn’t always going to be an improvement for page loading time. Where it can still be useful, however, is by reducing disk space and bandwidth on your own server, allowing Google to shoulder the load for you. In most cases, that’s not going to hurt your loading times too much.

Streaming de vídeo: Google Drive vs YouTube

O Google é o proprietário do YouTube, portanto, de qualquer forma, você está usando a mesma tecnologia. O desempenho será o mesmo, e a qualidade será exatamente a mesma. Então, por que se incomodar em comparar? Existem algumas pequenas diferenças entre o streaming de qualquer uma dessas duas fontes.

When your video is hosted on YouTube, it doesn’t cost you anything, and doesn’t take up any storage space you personally own or rent. Videos on YouTube are ad-supported, allow viewers to comment by default, and show a bunch of links to other videos at the end of the video. Users can also find a link to view an embedded video on YouTube instead of on your site. Both of these behaviors are highly undesirable.

Hosting videos on Google Drive means there are no ads, no suggested links at the end of the video, and no option to view the video on YouTube (since it’s not hosted there). Otherwise não há diferenças visíveis.

Hosting on YouTube can lead to greater exposure, if that’s what you’re after. Hosting on Google Drive gives you more control, more exclusivity, and helps keep the viewer on your site without the temptations offered by YouTube.

Ambos são melhores do que as alternativas, como o Vimeo, porque é mais fácil incluir legendas e a qualidade da transmissão pode ser ajustada pelo espectador para adequar sua velocidade de conexão.

O streaming de vídeo do Google Drive e do YouTube usa processos muito semelhantes.

1. Envie o vídeo para o seu Google Drive ou para o YouTube.

2. Carregue ou crie qualquer arquivo de legenda necessário.

3. Test your video. Don’t skip this important step.

4. Enquanto o vídeo estiver aberto, selecione os três pontos verticais no canto da tela e selecione “Compartilhar” no menu.

5. Clique no link “Avançado” na caixa de diálogo que aparece.

6. Clique no link “Alterar”.

7. Selecione “Ativado - Público na Web”

8. Then copy the link location and follow steps 9 to 13, except you’ll be using video HTML instead of image HTML, so your could will look something like this example:

The cc_load_policy property determines whether subtitles / closed captions should be visible by default. It’s good practice to set this to on, but Google applies the policy inconsistently anyway, possibly due to cross-platform complications.

Certifique-se de que você realmente precisa do CDN

Most of the time CDN works fine, but there can be times when a page hangs up because it’s trying to fetch a remote resource that simply won’t load. Google fonts, and certain other Google APIs, are notorious for this.

If you’re hosting your site on servers located in your own country and most of your traffic is local, using CDN may create more problems instead of less.

In any case, always check the results of modifications you make and be sure they’re really beneficial. If they’re not, rewind back to the point where your site was operating at maximum efficiency or try another strategy.

Using a CDN lets you create smaller websites, so even if there’s a slight performance price to pay, it may still be to your advantage if you host multiple sites from a single hosting account.

imagem de cabeçalho cortesia de

Bogdan Rancea

Bogdan é um membro fundador da Inspired Mag, acumulando quase 6 anos de experiência neste período. Em seu tempo livre, ele gosta de estudar música clássica e explorar artes visuais. Ele é muito obcecado com fixies também. Ele é dono do 5 já.

Comentários Respostas 0

Deixe um comentário

O seu endereço de e-mail não será publicado. Os campos obrigatórios são marcados com *

NOTA *

Este site usa o Akismet para reduzir o spam. Saiba como seus dados de comentário são processados.