Cloud Storage come opzione CDN

Se ti abboni a un servizio da un link in questa pagina, Reeves and Sons Limited potrebbe guadagnare una commissione. Vedi il nostro Dichiarazione etica.

Se hai un sito lento, probabilmente su un server condiviso che riceve molto traffico, potresti essere in grado di accelerare un po 'di tempo ospitando alcuni dei tuoi contenuti su una Content Delivery Network (CDN).

Sfortunatamente la CDN tradizionale ha spesso un prezzo fuori portata per un sito Web di piccole imprese, ma la buona notizia è che esiste un modo per configurare le unità di archiviazione cloud in modo che fungano da sistemi CDN personali. In questo articolo scopriremo alcuni metodi per farlo.

Cloud storage emulazione CDN vs puro CDN

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.

Scelta di un provider di archiviazione cloud

L'utilizzo dell'archiviazione cloud per CDN richiede che tu possa fare individual 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.

Distribuire i contenuti per cui si desidera essere pagati

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 è una rete decentralizzata di consegna di contenuti altamente specializzata basata su blockchain. Ti permette di auto-pubblicare qualsiasi cosa senza dipendenza da un intermediario.

Utilizzando connessioni peer-to-peer, il traffico DECENT è molto difficile da interrompere o bloccare, il che lo rende potenzialmente in grado di aggirare la censura. È più orientato alle transazioni commerciali e la tecnologia blockchain rende queste transazioni facili da proteggere.

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.

Un rapido confronto: 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.

Potresti non aver mai bisogno di preoccuparti dei prezzi, tuttavia, se le tue esigenze sono ragionevolmente modeste. Amazon S3 offre un accordo gratuito con 5GB di storage, richieste 20k get e richieste di 2k put.

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.

Google Cloud Storage è destinato a un uso a livello aziendale e, come tale, richiede una certa capacità tecnica per configurarlo e ottimizzarlo. Google Drive è di livello consumer, ma molto facile da usare con la sua semplice interfaccia web.

Google Drive ti mette in viaggio con un generoso 15GB di spazio di archiviazione gratuito, molto più di quanto la maggior parte dei siti web medi di piccole imprese abbia mai bisogno. Se dovessi trovare di più, puoi effettuare l'upgrade a:

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.

Per darti un'idea di quanto puoi archiviare in 15GB, vale approssimativamente 30 per i video 40 (m4v / mp4) per 1080 x 720 e 90 per la durata dei minuti, o per le foto 88,235 su 800 x 600 e ottimizzato per il web. Sarebbe inusuale per la piccola impresa media aver bisogno di così tanto per il suo sito web.

Google Drive è molto meno costoso di Amazon Drive. In termini di prestazioni, Amazon potrebbe avere un po 'di vantaggio e la documentazione con Amazon è migliore. Testa a testa, Google offre un valore complessivo migliore.

Quale dovresti scegliere? Dipende se consideri le prestazioni più importanti dei costi.

Hosting di immagini, CSS e JavaScript da Google Drive

Questo non è molto più complicato di ospitare video. In realtà, potrebbe anche essere più semplice. Ecco cosa devi fare:

1. Nel tuo Google Drive, crea una cartella speciale in cui archiviare i file

2. Assicurati che il nome che hai dato lo aiuti a distinguersi dalle altre cartelle di unità

3. Carica tutti i file in quella cartella (puoi anche creare sottocartelle)

4. Seleziona la cartella che verrà condivisa e fai clic sul pulsante di condivisione

5. Quando viene visualizzata la finestra di dialogo di condivisione, seleziona "Avanzate"

6. Nella finestra di dialogo Impostazioni di condivisione più avanzata, seleziona "Modifica"

7. Ora cambia l'impostazione in "Attivo - Pubblico sul Web"

8. Dovrai ripetere la procedura sopra per ogni indivianche doppio file

9. Copia il link per ogni risorsa e incollalo in un editor di testo

10. Elimina tutto tranne l'ID del file

11. Ora aggiungi il testo "https://drive.google.com/uc?export=view&" davanti all'ID del file

12. Ora puoi modificare il tuo HTML. Per i CSS:

Per JS:

Per un'immagine:

13. Carica la versione di test del file HTML e prova la velocità rispetto al file originale

Originale:

Versione di test aggiornata con CDN di Google Drive:

Qualcosa di molto importante da notare qui è che con CDN abilitato, le prestazioni sono state effettivamente ridotte. Ciò è accaduto perché il mio server web comprime automaticamente tutto, ma le risorse trasferite su Google Drive non vengono compresse 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 video: Google Drive vs YouTube

Google è il proprietario di YouTube, quindi in entrambi i casi stai utilizzando la stessa tecnologia. Le prestazioni saranno pressoché le stesse e la qualità sarà esattamente la stessa, quindi perché preoccuparsi del confronto? Ci sono alcune piccole differenze tra lo streaming da una di queste due fonti.

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 non ci sono differenze visibili.

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.

Entrambi sono migliori delle alternative come Vimeo, perché è più facile includere i sottotitoli e la qualità dello streaming può essere regolata dal visualizzatore per adattarsi alla loro velocità di connessione.

Lo streaming di video da Google Drive e YouTube utilizza processi molto simili.

1. Carica il video sul tuo Google Drive o su YouTube.

2. Carica o crea qualsiasi file di sottotitoli richiesto.

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

4. Mentre il video è aperto, seleziona i tre punti verticali nell'angolo dello schermo, quindi seleziona "Condividi" dal menu.

5. Fare clic sul collegamento "Avanzate" nella finestra di dialogo che appare.

6. Fare clic sul collegamento "Modifica".

7. Seleziona "Attivo - Pubblico sul 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.

Assicurati di aver davvero bisogno della 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.

immagine di cortesia per gentile concessione di

Bogdan Rancea

Bogdan è membro fondatore di Inspired Mag, avendo accumulato quasi 6 anni di esperienza in questo periodo. Nel tempo libero ama studiare musica classica ed esplorare le arti visive. È piuttosto ossessionato dai fissaggi. Possiede già 5.

Commenti Risposte 0

Lascia un Commento

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati con *

Valutazione *

Questo sito utilizza Akismet per ridurre lo spam. Scopri come vengono elaborati i dati dei tuoi commenti.