Re: Hosting a CDN question

2020-03-18 Thread Stuart Henderson
On 2020/03/19 00:55, tom ryan wrote:
> On 2020-03-18 19:42, Stuart Henderson wrote:
> > On 2020-03-17, Flipchan  wrote:
> >> Yeah the point with a cdn is to lower the latency of it so therefor you 
> >> what is needed is just not only a fast http server but  a traffic 
> >> redirector depending on the end users origin
> > 
> > Doing this via redirects does not lower latency, it increases it.
> > 
> > It may reduce overall time to fetch objects if they are large enough
> > that faster transfers speed things up enough to offset the higher
> > latency from connecting to one server, requesting, being redirected,
> > connecting to the second server, requesting, receiving content.
> 
> This is equally true if there are many objects to fetch, especially if
> they aren't all fetched at once - they don't need to be large for the
> magic to help.

It's faster than a cold connection, but "request from A, wait for reply,
see that it's a redirect, request from B, wait for reply" is always going
be higher latency before starting to receive the requested object
directly from B.

> > To reduce latency you need another way to direct users to a nearby
> > server without doing redirects. Usually either geolocation-aware DNS
> > that hands out an IP address close to the user's DNS resolver (this
> > can have problems if the user uses a non-local resolver as is the case
> > with some DNS privacy services, but is not usually too bad - look at
> > thd geoip flavour of the isc-bind port, or gdnsd)), or BGP anycast with
> > connections to other networks around the world (as well as BGP skills,
> > you need an AS number, at least a /24 of address space that you can use
> > for this purpose, and hosting providers that will allow you to make BGP
> > announcements).
> 
> I've never used this, but it definitely attempts to solve these issues:
> https://trafficcontrol.apache.org/
> 
> IIRC it was developed at Comcast for VOD (ie many large objects), and is
> built around Apache Traffic Server (ex Yahoo)
> 
> It uses DNS to get as close as it can, then 302s the first HTTP request
> based on source IP



> > Alternatively the pages pulling in the content can do a dynamic
> > lookup and use a local-to-the-user hostname when referencing
> > the objects 

Re: Hosting a CDN question

2020-03-18 Thread tom ryan
On 2020-03-18 19:42, Stuart Henderson wrote:
> On 2020-03-17, Flipchan  wrote:
>> Yeah the point with a cdn is to lower the latency of it so therefor you what 
>> is needed is just not only a fast http server but  a traffic redirector 
>> depending on the end users origin
> 
> Doing this via redirects does not lower latency, it increases it.
> 
> It may reduce overall time to fetch objects if they are large enough
> that faster transfers speed things up enough to offset the higher
> latency from connecting to one server, requesting, being redirected,
> connecting to the second server, requesting, receiving content.

This is equally true if there are many objects to fetch, especially if
they aren't all fetched at once - they don't need to be large for the
magic to help.

> To reduce latency you need another way to direct users to a nearby
> server without doing redirects. Usually either geolocation-aware DNS
> that hands out an IP address close to the user's DNS resolver (this
> can have problems if the user uses a non-local resolver as is the case
> with some DNS privacy services, but is not usually too bad - look at
> thd geoip flavour of the isc-bind port, or gdnsd)), or BGP anycast with
> connections to other networks around the world (as well as BGP skills,
> you need an AS number, at least a /24 of address space that you can use
> for this purpose, and hosting providers that will allow you to make BGP
> announcements).

I've never used this, but it definitely attempts to solve these issues:
https://trafficcontrol.apache.org/

IIRC it was developed at Comcast for VOD (ie many large objects), and is
built around Apache Traffic Server (ex Yahoo)

It uses DNS to get as close as it can, then 302s the first HTTP request
based on source IP

> Alternatively the pages pulling in the content can do a dynamic
> lookup and use a local-to-the-user hostname when referencing
> the objects 

Re: Hosting a CDN question

2020-03-18 Thread Stuart Henderson
On 2020-03-17, Flipchan  wrote:
> Yeah the point with a cdn is to lower the latency of it so therefor you what 
> is needed is just not only a fast http server but  a traffic redirector 
> depending on the end users origin

Doing this via redirects does not lower latency, it increases it.

It may reduce overall time to fetch objects if they are large enough
that faster transfers speed things up enough to offset the higher
latency from connecting to one server, requesting, being redirected,
connecting to the second server, requesting, receiving content.

To reduce latency you need another way to direct users to a nearby
server without doing redirects. Usually either geolocation-aware DNS
that hands out an IP address close to the user's DNS resolver (this
can have problems if the user uses a non-local resolver as is the case
with some DNS privacy services, but is not usually too bad - look at
thd geoip flavour of the isc-bind port, or gdnsd)), or BGP anycast with
connections to other networks around the world (as well as BGP skills,
you need an AS number, at least a /24 of address space that you can use
for this purpose, and hosting providers that will allow you to make BGP
announcements).

Alternatively the pages pulling in the content can do a dynamic
lookup and use a local-to-the-user hostname when referencing
the objects 

Re: Hosting a CDN question

2020-03-17 Thread Aaron Mason
In that case, relayd would be the most likely port of call.

On Wed, Mar 18, 2020 at 10:06 AM Flipchan  wrote:
>
> Yeah the point with a cdn is to lower the latency of it so therefor you what 
> is needed is just not only a fast http server but a traffic redirector 
> depending on the end users origin
>
> On March 17, 2020 3:44:27 AM GMT+01:00, Aaron Mason 
>  wrote:
>>
>> You can easily "write" one in Go with 9 lines of code.  And since Go
>> builds static binaries, you can chroot it for security.
>>
>> I just did a quick test between httpd and a web server written in Go
>> and on a simple text file with 20,000 requests from 10 threads I saw a
>> 2.3x improvement on a pair of tests.
>>
>> On Mon, Mar 16, 2020 at 9:28 PM Flipchan  wrote:
>>>
>>>
>>>  Hey all,
>>>
>>>  My company needs to put up a cdn for fast hosting of javascript, images 
>>> and css for websites, and then i would need something faster then httpd.
>>>
>>>
>>>  Does anyone here run a cdn for static website content?
>>>
>>>  If so what software did u use to set it up ?
>>>
>>>  have a good one
>>>  Sincerely
>>>  Filip
>>
>>
>>
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.



-- 
Aaron Mason - Programmer, open source addict
I've taken my software vows - for beta or for worse



Re: Hosting a CDN question

2020-03-17 Thread Flipchan
Yeah the point with a cdn is to lower the latency of it so therefor you what is 
needed is just not only a fast http server but  a traffic redirector depending 
on the end users origin

On March 17, 2020 3:44:27 AM GMT+01:00, Aaron Mason  
wrote:
>You can easily "write" one in Go with 9 lines of code.  And since Go
>builds static binaries, you can chroot it for security.
>
>I just did a quick test between httpd and a web server written in Go
>and on a simple text file with 20,000 requests from 10 threads I saw a
>2.3x improvement on a pair of tests.
>
>On Mon, Mar 16, 2020 at 9:28 PM Flipchan  wrote:
>>
>> Hey all,
>>
>> My company needs to put up a cdn for fast hosting of javascript,
>images and css for websites, and then i would need something faster
>then httpd.
>>
>>
>> Does anyone here run a cdn for static website content?
>>
>> If so what software did u use to set it up ?
>>
>> have a good one
>> Sincerely
>> Filip
>
>
>
>-- 
>Aaron Mason - Programmer, open source addict
>I've taken my software vows - for beta or for worse

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


Re: Hosting a CDN question

2020-03-17 Thread Kevin Chadwick
On 2020-03-17 02:48, Aaron Mason wrote:
> It's worth noting that httpd didn't go over ~30% in the test, whereas
> the Go web server absolutely slammed the system.

I wonder if this is linked to Go's concurrency.

Personally I would look into tweaking httpd defaults and relayd as GOs net/http
runs everything as one user and so I prefer to gain httpds TLS key protection
with go via fcgi akin to gcp app engine.

You also need to tweak timeouts etc. for Go, as it's defaults are not ready for
production (easy DOS upon internet exposure) without being behind app
engine/httpd etc.

I would also trust httpds routing over gorilla/mux, though stdlib mux is
probably closer (no regex) but *maybe* not as powerful as httpds.

Of course fcgi *may* slow it down further, if HW cost is paramount.



Re: Hosting a CDN question

2020-03-17 Thread infoomatic

varnish does not bring down the network latency if users are sitting on
the other end of the world...


On 17.03.20 08:48, Wayne Oliver wrote:

On 2020/03/16 12:26, Flipchan wrote:

Hey all,

My company needs to put up a cdn for fast hosting of javascript,
images and css for websites, and then i would need something faster
then httpd.


Does anyone here run a cdn for static website content?

If so what software did u use to set it up ?

have a good one
Sincerely
Filip



What about sticking a caching server/s in front of your httpd instance/s.
e.g. https://varnish-cache.org/





Re: Hosting a CDN question

2020-03-17 Thread Wayne Oliver

On 2020/03/16 12:26, Flipchan wrote:

Hey all,

My company needs to put up a cdn for fast hosting of javascript, images and css 
for websites, and then i would need something faster then httpd.


Does anyone here run a cdn for static website content?

If so what software did u use to set it up ?

have a good one
Sincerely
Filip



What about sticking a caching server/s in front of your httpd instance/s.
e.g. https://varnish-cache.org/



Re: Hosting a CDN question

2020-03-16 Thread Jordan Geoghegan




On 2020-03-16 03:26, Flipchan wrote:

Hey all,

My company needs to put up a cdn for fast hosting of javascript, images and css 
for websites, and then i would need something faster then httpd.


Does anyone here run a cdn for static website content?

If so what software did u use to set it up ?

have a good one
Sincerely
Filip


What level of traffic are you looking to push? Have you done any tests 
to confirm httpd was unsuitable or was the bottleneck?


When coupled with relayd, you can have a very powerful setup. I have a 
setup with relayd + httpd on modest hardware, and I can push over 5,000 
requests per second.




Re: Hosting a CDN question

2020-03-16 Thread Aaron Mason
It's worth noting that httpd didn't go over ~30% in the test, whereas
the Go web server absolutely slammed the system.

On Tue, Mar 17, 2020 at 1:44 PM Aaron Mason  wrote:
>
> You can easily "write" one in Go with 9 lines of code.  And since Go
> builds static binaries, you can chroot it for security.
>
> I just did a quick test between httpd and a web server written in Go
> and on a simple text file with 20,000 requests from 10 threads I saw a
> 2.3x improvement on a pair of tests.
>
> On Mon, Mar 16, 2020 at 9:28 PM Flipchan  wrote:
> >
> > Hey all,
> >
> > My company needs to put up a cdn for fast hosting of javascript, images and 
> > css for websites, and then i would need something faster then httpd.
> >
> >
> > Does anyone here run a cdn for static website content?
> >
> > If so what software did u use to set it up ?
> >
> > have a good one
> > Sincerely
> > Filip
>
>
>
> --
> Aaron Mason - Programmer, open source addict
> I've taken my software vows - for beta or for worse



-- 
Aaron Mason - Programmer, open source addict
I've taken my software vows - for beta or for worse



Re: Hosting a CDN question

2020-03-16 Thread Aaron Mason
You can easily "write" one in Go with 9 lines of code.  And since Go
builds static binaries, you can chroot it for security.

I just did a quick test between httpd and a web server written in Go
and on a simple text file with 20,000 requests from 10 threads I saw a
2.3x improvement on a pair of tests.

On Mon, Mar 16, 2020 at 9:28 PM Flipchan  wrote:
>
> Hey all,
>
> My company needs to put up a cdn for fast hosting of javascript, images and 
> css for websites, and then i would need something faster then httpd.
>
>
> Does anyone here run a cdn for static website content?
>
> If so what software did u use to set it up ?
>
> have a good one
> Sincerely
> Filip



-- 
Aaron Mason - Programmer, open source addict
I've taken my software vows - for beta or for worse



Hosting a CDN question

2020-03-16 Thread Flipchan
Hey all,

My company needs to put up a cdn for fast hosting of javascript, images and css 
for websites, and then i would need something faster then httpd.


Does anyone here run a cdn for static website content?

If so what software did u use to set it up ? 

have a good one
Sincerely
Filip