Wowza Community

connections per VHost

Hi,

How can I check total connections per VHost ?

I have the default VHost at port 1935 and a new VHost at port 1936. If I check:

http://:1935

and

http://:1936

Wowza always returns the same value for both ports (server=4).

How Can I check each port’s connections ?

here my VHost.xml

<Root>
	<VHost>
		<HostPortList>
			<HostPort>
				<ProcessorCount>8</ProcessorCount>
				<IpAddress>*</IpAddress>
				<Port>1935,80,443</Port>
				<SocketConfiguration>
					<ReuseAddress>true</ReuseAddress>
					<!-- suggested settings for video on demand applications -->
					<ReceiveBufferSize>24000</ReceiveBufferSize>
					<SendBufferSize>65000</SendBufferSize>
					<!-- suggest settings for low latency chat and video recording applications
					<ReceiveBufferSize>16000</ReceiveBufferSize>
					<SendBufferSize>16000</SendBufferSize>
					-->
					<KeepAlive>true</KeepAlive>
					<!-- <TrafficClass>0</TrafficClass> -->
					<!-- <OobInline>false</OobInline> -->
					<!-- <SoLingerTime>-1</SoLingerTime> -->
					<!-- <TcpNoDelay>false</TcpNoDelay> -->
					<AcceptorBackLog>100</AcceptorBackLog>
				</SocketConfiguration>
				<HTTPStreamerAdapterIDs>cupertinostreaming,smoothstreaming</HTTPStreamerAdapterIDs>
				<HTTPProviders>
					<HTTPProvider>
						<BaseClass>com.wowza.wms.http.HTTPCrossdomain</BaseClass>
						<RequestFilters>*crossdomain.xml</RequestFilters>
						<AuthenticationMethod>none</AuthenticationMethod>
					</HTTPProvider>
					<HTTPProvider>
						<BaseClass>com.wowza.wms.http.HTTPClientAccessPolicy</BaseClass>
						<RequestFilters>*clientaccesspolicy.xml</RequestFilters>
						<AuthenticationMethod>none</AuthenticationMethod>
					</HTTPProvider>
					<HTTPProvider>
						<BaseClass>com.wowza.wms.http.HTTPConnectionInfo</BaseClass>
						<RequestFilters>*</RequestFilters>
						<AuthenticationMethod>none</AuthenticationMethod>
					</HTTPProvider>
				</HTTPProviders>
			</HostPort>
			
			<HostPort>
				<ProcessorCount>1</ProcessorCount>
				<IpAddress>*</IpAddress>
				<Port>8086</Port>
				<SocketConfiguration>
					<ReuseAddress>true</ReuseAddress>
					<ReceiveBufferSize>16000</ReceiveBufferSize>
					<SendBufferSize>16000</SendBufferSize>
					<KeepAlive>true</KeepAlive>
					<AcceptorBackLog>100</AcceptorBackLog>
				</SocketConfiguration>
				<HTTPStreamerAdapterIDs></HTTPStreamerAdapterIDs>
				<HTTPProviders>
					<HTTPProvider>
						<BaseClass>com.wowza.wms.http.streammanager.HTTPStreamManager</BaseClass>
						<RequestFilters>streammanager*</RequestFilters>
						<AuthenticationMethod>admin-digest</AuthenticationMethod>
					</HTTPProvider>
					<HTTPProvider>
						<BaseClass>com.wowza.wms.http.HTTPServerInfoXML</BaseClass>
						<RequestFilters>serverinfo*</RequestFilters>
						<AuthenticationMethod>admin-digest</AuthenticationMethod>
					</HTTPProvider>
					<HTTPProvider>
						<BaseClass>com.wowza.wms.http.HTTPConnectionInfo</BaseClass>
						<RequestFilters>connectioninfo*</RequestFilters>
						<AuthenticationMethod>admin-digest</AuthenticationMethod>
					</HTTPProvider>
					<HTTPProvider>
						<BaseClass>com.wowza.wms.http.HTTPConnectionCountsXML</BaseClass>
						<RequestFilters>connectioncounts*</RequestFilters>
						<AuthenticationMethod>admin-digest</AuthenticationMethod>
					</HTTPProvider>
					<HTTPProvider>
						<BaseClass>com.wowza.wms.http.HTTPServerVersion</BaseClass>
						<RequestFilters>*</RequestFilters>
						<AuthenticationMethod>none</AuthenticationMethod>
					</HTTPProvider>
				</HTTPProviders>
			</HostPort>
		</HostPortList>
		
		<HTTPStreamerAdapters>
			<HTTPStreamerAdapter>
				<ID>smoothstreaming</ID>
				<Name>smoothstreaming</Name>
				<Properties>
				</Properties>
			</HTTPStreamerAdapter>
			<HTTPStreamerAdapter>
				<ID>cupertinostreaming</ID>
				<Name>cupertinostreaming</Name>
				<Properties>
				</Properties>
			</HTTPStreamerAdapter>
		</HTTPStreamerAdapters>
		<HandlerThreadPool>
			<PoolSize>180</PoolSize>
		</HandlerThreadPool>
		<TransportThreadPool>
			<PoolSize>120</PoolSize>
		</TransportThreadPool>
		<IdleWorkers>
			<WorkerCount>8</WorkerCount>
			<CheckFrequency>50</CheckFrequency>
			<MinimumWaitTime>5</MinimumWaitTime>
		</IdleWorkers>
		<NetConnections>
			<ProcessorCount>8</ProcessorCount>
			<IdleFrequency>250</IdleFrequency>
			<SocketConfiguration>
				<ReuseAddress>true</ReuseAddress>
				<ReceiveBufferSize>65000</ReceiveBufferSize>
				<SendBufferSize>24000</SendBufferSize>
				<KeepAlive>true</KeepAlive>
				<!-- <TrafficClass>0</TrafficClass> -->
				<!-- <OobInline>false</OobInline> -->
				<!-- <SoLingerTime>-1</SoLingerTime> -->
				<!-- <TcpNoDelay>false</TcpNoDelay> -->
				<AcceptorBackLog>100</AcceptorBackLog>
			</SocketConfiguration>
		</NetConnections>
		<HTTPTunnel>
			<KeepAliveTimeout>2000</KeepAliveTimeout>
		</HTTPTunnel>
		<Client>
			<ClientTimeout>90000</ClientTimeout>
			<IdleFrequency>250</IdleFrequency>
		</Client>
		<!-- RTP/Authentication/Methods defined in Authentication.xml. Default setup includes; none, basic, digest -->
		<RTP>
			<IdleFrequency>125</IdleFrequency>
			<DatagramConfiguration>
				<Incoming>
					<ReuseAddress>true</ReuseAddress>
					<ReceiveBufferSize>512000</ReceiveBufferSize>
					<SendBufferSize>65000</SendBufferSize>
					<!-- <MulticastBindToAddress>true</MulticastBindToAddress> -->
					<!-- <TrafficClass>0</TrafficClass> -->
					<MulticastTimeout>50</MulticastTimeout>
					<DatagramMaximumPacketSize>8192</DatagramMaximumPacketSize>
				</Incoming>
				<Outgoing>
					<ReuseAddress>true</ReuseAddress>
					<ReceiveBufferSize>65000</ReceiveBufferSize>
					<SendBufferSize>65000</SendBufferSize>
					<!-- <MulticastBindToAddress>true</MulticastBindToAddress> -->
					<!-- <TrafficClass>0</TrafficClass> -->
					<MulticastTimeout>50</MulticastTimeout>
					<DatagramMaximumPacketSize>8192</DatagramMaximumPacketSize>
				</Outgoing>
			</DatagramConfiguration>
			<UnicastIncoming>
				<ProcessorCount>1</ProcessorCount>
			</UnicastIncoming>
			<UnicastOutgoing>
				<ProcessorCount>1</ProcessorCount>
			</UnicastOutgoing>
			<MulticastIncoming>
				<ProcessorCount>1</ProcessorCount>
			</MulticastIncoming>
			<MulticastOutgoing>
				<ProcessorCount>1</ProcessorCount>
			</MulticastOutgoing>
		</RTP>
		<Application>
			<ApplicationTimeout>60000</ApplicationTimeout>
			<PingTimeout>12000</PingTimeout>
			<ValidationFrequency>20000</ValidationFrequency>
			<MaximumPendingWriteBytes>0</MaximumPendingWriteBytes>
			<MaximumSetBufferTime>60000</MaximumSetBufferTime>
		</Application>
		<!-- Properties defined here will be added to the IVHost.getProperties() collection -->
		<Properties>
		</Properties>
	</VHost>
</Root>

And my VHosts.xml:

<Root>
	<VHosts>
		<VHost>
			<Name>_defaultVHost_</Name>
			<ConfigDir>${com.wowza.wms.ConfigHome}</ConfigDir>
			<ConnectionLimit>0</ConnectionLimit>
		</VHost>
		<VHost>
			<Name>vhost1</Name>
			<ConfigDir>${com.wowza.wms.ConfigHome}/vhosts/vhost1</ConfigDir>
			<ConnectionLimit>0</ConnectionLimit>
		</VHost>
	</VHosts>
</Root>

Thanks !

You will have to create a HTTProvider that returns connection count just for that VHost. Use this:

package com.wowza.wms.example.module.http;
import java.io.*;
import com.wowza.wms.http.*;
import com.wowza.wms.logging.*;
import com.wowza.wms.vhost.*;
public class HTTPVHostCount extends HTTProvider2Base {
	public void onHTTPRequest(IVHost vhost, IHTTPRequest req, IHTTPResponse resp) {
		if (!doHTTPAuthentication(vhost, req, resp))
			return;
		String retStr = "<html><head><title>"
				+ "</title></head><body>VHost " + vhost.getName() + " connection count = " + vhost.getConnectionCounter().getTotal() + "</body></html>";
		
		try {
			OutputStream out = resp.getOutputStream();
			byte[] outBytes = retStr.getBytes();
			out.write(outBytes);
		} catch (Exception e) {
			WMSLoggerFactory.getLogger(null).error("HTTPTest: " + e.toString());
		}
	}
}
}

You will need to compile this in the Wowza IDE, then add HTTProvider 2nd to last in the list of HTTProviders of the HostPort:

<HTTPProvider>
	<BaseClass>com.wowza.wms.example.module.http.HTTPVHostCount</BaseClass>
	<RequestFilters>vhostcount*</RequestFilters>
	<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>

Then you can reference like this in a browser:

http://[wowza-address]:1935/vhostcount

Will return:

VHost defaultVHost connection count = 1

Or if you add it your custom VHost in the HostPort that uses port 1936

http://[wowza-address]:1936/vhostcount

Will return:

VHost [CustomVHostName] connection count = 1