| View previous topic :: View next topic |
| Author |
Message |
m3gab0y
Joined: 15 Aug 2009 Posts: 47 Location: London, UK
|
Posted: Tue Aug 03, 2010 11:56 am Post subject: |
|
|
| karlH wrote: |
the burst on connect setting was next to useless over burst-size, which is why it was deprecated in the 2.3 release. If that is of sufficient size (default 64k) then bursting that should be quicker than others post kh10. These delays being tuned should only apply when there is a stall required but if you do see an issue then let me know the specifics.
karl. |
Bursting by default on the production server is 512 kb and the queue 4x larger than default. I use kh8 on the production server and it runs faster than shoutcast (RAM usage and bandwidth are not problem)
As I managed to loose the tarball with kh8, please upload it again, as kh24.6 is not good for production and I need to launch few new servers today
It seems that theese limits do cause lots I mean lots of issues with some encoders, for example SAM Broadcaster encoders do get frequently disconnected, due to the fact that for some reason they can't fill up the buffer again if they fall behind for some reason. At kh8 the encoders work fine even with gprs connection at a place where the cellular signal is second to none  |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue Aug 03, 2010 1:49 pm Post subject: |
|
|
kh8 is uploaded although kh9a was the last one before the big thread changes.
kh24.16 looks like it will become kh25. I'm not sure what you mean by limits here as all these scheduling changes are subsecond responses so if there are disconnections then it has nothing to do with those, unless you are saying it's an accumulated starvation issue. If you can provide something specific setup that shows an issue then maybe I can investigate it.
karl. |
|
| Back to top |
|
 |
m3gab0y
Joined: 15 Aug 2009 Posts: 47 Location: London, UK
|
Posted: Tue Aug 03, 2010 7:44 pm Post subject: |
|
|
| karlH wrote: |
kh8 is uploaded although kh9a was the last one before the big thread changes.
kh24.16 looks like it will become kh25. I'm not sure what you mean by limits here as all these scheduling changes are subsecond responses so if there are disconnections then it has nothing to do with those, unless you are saying it's an accumulated starvation issue. If you can provide something specific setup that shows an issue then maybe I can investigate it.
karl. |
Let me explain it easy as i'm really tired...
I use the same minimum config for Icecast KH8 and KH24.6, here it is:
| Code: |
<icecast>
<server-id>Icecast 2.3.2</server-id>
<limits>
<clients>1024</clients>
<sources>5</sources>
<queue-size>2097152</queue-size>
<client-timeout>300</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>10</source-timeout>
<!-- same as burst-on-connect, but this allows for being more
specific on how much to burst. Most people won't need to
change from the default 64k. Applies to all mountpoints -->
<burst-on-connect>1</burst-on-connect>
<burst-size>524280</burst-size>
<!--
<max-bandwidth>100M</max-bandwidth>
-->
</limits>
<authentication>
<!-- Configure the shoutcast DSP to use this password -->
<source-password>fuckme</source-password>
<!-- This is used for icecast's web interface -->
<admin-user>admin</admin-user>
<admin-password>fuckme</admin-password>
</authentication>
<!--
<directory>
<yp-url-timeout>15</yp-url-timeout>
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
</directory>
-->
<!-- This is the hostname other people will use to connect to your server.
It affects mainly the urls generated by Icecast for playlists and yp
listings. -->
<hostname>m3gab0y.com</hostname>
<!-- each shoutcast source clients require 2 ports, port and port+1 -->
<listen-socket>
<!-- define the base port that the shoutcast DSP will use -->
<port>****</port>
<!-- the following is acts as a switch to not only inform icecast
of the mountpoint to use but also that port+1 should be implicitily
defined as well. -->
<shoutcast-mount>/live</shoutcast-mount>
</listen-socket>
<mount>
<mount-name>/rc128</mount-name>
<public>0</public>
<hidden>1</hidden>
</mount>
<mount>
<mount-name>/live</mount-name>
<public>0</public>
<hidden>1</hidden>
</mount>
<relay>
<server>77.70.***.***</server>
<port>11501</port>
<mount>/rc128</mount>
<local-mount>/rc128</local-mount>
<on-demand>0</on-demand>
<retry-delay>30</retry-delay>
<relay-shoutcast-metadata>1</relay-shoutcast-metadata>
</relay>
<fileserve>1</fileserve>
<paths>
<logdir>./logs</logdir>
<webroot>./web</webroot>
<adminroot>./admin</adminroot>
<alias source="/" dest="/index.html"/>
</paths>
<logging>
<accesslog>access.log</accesslog>
<errorlog>error.log</errorlog>
<loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
</logging>
<security>
<chroot>0</chroot>
</security>
</icecast>
|
Icecast runs on the same Win32 mashine, at diffirent ports for each KH release. (i'm connecting to theese via private peering network with 1 gbps connectivity speed)
The production server is with simmular config.
So here's what happens when I connect a "listener":
KH8 - I get the 512 kb of data for less than half a second and then after the bursting is done the rate is normal
KH24.6 - I get 80-90kb the first second, at 20kb increasements (small packets) and after a while at this speed when the bursting is done everything is back to normal.
I used wget-based script to measure this, but here is another simple example. I connect a Winamp player with it's default settings that require around 256 kb + 50% more of them to buffer, before outputting a sound.
In KH8 I literally get this buffer full and the stream playing when I click play, it's almost instant.
In KH24.6 (same settings) Winamp needs like 8-10 seconds to buffer it up and then play it.
I hope this time you understood what I mean.
Regards.
p.s. your links for kh8 need to be updated, not everyone can guess that it's not located at techno.fm  |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Aug 04, 2010 1:16 am Post subject: |
|
|
I think that you were being hit by the longer delay on stall case. I've shortened that so It should be quicker now and not cause any excessive retrying on stalled cases. On win32 though you should try to increase the send buffer size to allow for more bandwidth on the link, win32 has traditionally been rubbish in that regard so add <so-sndbuf>16384</so-sndbuf> in the <listen-sock> (try with different numbers as I understand that 8k is the default).
karl. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Aug 04, 2010 1:22 am Post subject: |
|
|
kh25 is up. The possible flv frame skipping should be gone now and quicker rescheduling for clients. A couple of possible crash cases have been fixed and some internal code cleanup, less locking etc.
karl. |
|
| Back to top |
|
 |
m3gab0y
Joined: 15 Aug 2009 Posts: 47 Location: London, UK
|
Posted: Wed Aug 04, 2010 7:29 am Post subject: |
|
|
| karlH wrote: |
kh25 is up. The possible flv frame skipping should be gone now and quicker rescheduling for clients. A couple of possible crash cases have been fixed and some internal code cleanup, less locking etc.
karl. |
That's much better I knew you could do it
I've just used <so-sndbuf>1048560</so-sndbuf> and the problem is solved now even it's faster than kh8
Are there any related parameters to this in the config file, that are not anounced on the documentation ? |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Aug 04, 2010 1:13 pm Post subject: |
|
|
I don't know the full extent of the memory allocation on win32 but with these send buffers, 1000 icecast connections each with 1 Meg send buffer will be at least 1 Gig of ram, so be wary of the usage. I think I should be able to migrate this option to a per-mount one as these large buffers won't be needed typically, many just have low bandwidth streams.
Most Unix-like boxes these days use TCP window scaling so having fixed window sizes is generally not an issue but for some reason that capability under win32 (that I've tried) seems to be missing and the default is poor for this sort of application. Thankfully these sorts of hacks/workarounds are rare. It wasn't documented because I wasn't sure on whether that would be the end option but it does seem to help win32 users better.
karl. |
|
| Back to top |
|
 |
m3gab0y
Joined: 15 Aug 2009 Posts: 47 Location: London, UK
|
Posted: Fri Aug 06, 2010 10:41 am Post subject: |
|
|
| karlH wrote: |
I don't know the full extent of the memory allocation on win32 but with these send buffers, 1000 icecast connections each with 1 Meg send buffer will be at least 1 Gig of ram, so be wary of the usage. I think I should be able to migrate this option to a per-mount one as these large buffers won't be needed typically, many just have low bandwidth streams.
Most Unix-like boxes these days use TCP window scaling so having fixed window sizes is generally not an issue but for some reason that capability under win32 (that I've tried) seems to be missing and the default is poor for this sort of application. Thankfully these sorts of hacks/workarounds are rare. It wasn't documented because I wasn't sure on whether that would be the end option but it does seem to help win32 users better.
karl. |
OK I understand completely. Just here thanks to the TCP Windows scaling over windows and thanks to the really fast peering speed I have to use theese outrageous buffers. I don't think it will be issue to use it on the production server since it's 8GB RAM.
The current memory used by Icecast KH25 under WinXP is around 25MB total with around 20 listeners average. |
|
| Back to top |
|
 |
m3gab0y
Joined: 15 Aug 2009 Posts: 47 Location: London, UK
|
Posted: Fri Aug 06, 2010 7:36 pm Post subject: |
|
|
btw. a GREAT idea will be to add a feature that limits the concurent connections from a single IP to the icecast server and to a specific mount.
The idea is not to allow 100s of "listeners" from one IP and limit this to reasonable value
Karl, please, consider this. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue Aug 10, 2010 8:41 pm Post subject: |
|
|
You could use auth scripts to manipulate the deny IP file but that will add latency on the new connection for acceptable IPs.
I suppose this sort of thing could use the internal ban function, like the ban-client does now but don't 403 the client afterwards. The issue there is that it's temporary and dropped over xml reload. You probably want that per-mount not server wide as web pages tend to trigger several parallel requests (eg images, css etc)
karl. |
|
| Back to top |
|
 |
m3gab0y
Joined: 15 Aug 2009 Posts: 47 Location: London, UK
|
Posted: Thu Aug 12, 2010 8:25 am Post subject: |
|
|
| karlH wrote: |
You could use auth scripts to manipulate the deny IP file but that will add latency on the new connection for acceptable IPs.
I suppose this sort of thing could use the internal ban function, like the ban-client does now but don't 403 the client afterwards. The issue there is that it's temporary and dropped over xml reload. You probably want that per-mount not server wide as web pages tend to trigger several parallel requests (eg images, css etc)
karl. |
Yes, that's exactly what i mean. It's a bad idea to deal with scripts and this won't stop bad users from flooding. Just like a simmular software you could add a limit for concurent connections per ip on mount-by-mount basis. And maybe you could just "disconnect with no reply" rather than returning 403 code
btw. Can you consider adding a "redirect" function to redirect listeners to another server (a classic 302 redirect when the mount is full or 301 redirect when we want to serve some other stuff over this mount permanently) |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Aug 12, 2010 3:58 pm Post subject: |
|
|
The limit is such cases would be 1, because the ban would drop a connection immediately, no reading or 403 either. It would allow one onto a mountpoint but not allow subsequent connections, but could be made available when client disconnects.
The redirect option works already, just setup a slave icecast with the
<master> <redirect>true</redirect> <server>....<...> </master>
settings. You can use the relay-user/pass on the master to match or define an authenticated mount for /admin/streams to allow for multiple usernames.
karl. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue Aug 17, 2010 3:08 pm Post subject: |
|
|
kh26 is now up. There were a couple of last minute fixes so if you saw a kh26 before this then re-download it. The main fixes of kh25 are possible corruption for non-ogg metadata if bandwidth limit reached and hidden streams were being listed for slaves.
karl. |
|
| Back to top |
|
 |
ab-tools
Joined: 07 Sep 2010 Posts: 2
|
Posted: Thu Sep 09, 2010 11:53 am Post subject: |
|
|
Hello Karl,
first thank you for your great work on IceCast in your KH branch.
We're currently using the default 2.3.2 version of IceCast, but due to some performance issues I have a look on your version at the moment.
It's a very good idea to have multiple worker threads. This way a multi-core CPU can be used much more efficiently.
But I came across one question:
while on-demand playback (normal file serving) is used all clients are allocated evenly across the worker threads, but when playing a relayed stream all clients are allocated to the thread of the source client.
I saw in code ("source.c"=>"send_listener()"=>"do we migrate this listener to the same handler as the source client") already that this is done with intent, but I still don't understand exactly why it's better if all listeners are in the same worker thread as the source client:
however, I guess the multiple worker threads should prevent from performance problems when it takes too long to send the data to all clients in the same thread which would result in buffering in the players. Does this problem not occur for relayed streams or why are all listeners assigned to the same thread as the source client in case of relayed streams? What's the advantage of this solution?
Best regards and thanks in advance for your support
Andreas |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Sep 09, 2010 2:56 pm Post subject: |
|
|
The listeners get moved to the same worker thread as the client reading the stream, this help reduce lock contention. Also the clients reading the stream can move to less busy workers if doing so would spread load. This migration allows for changes in workload such as streams disappearing or many listeners disconnecting or workers being added or removed.
karl. |
|
| Back to top |
|
 |
|