A CPU issue

UI Components for JSF
Post Reply
jguerra
Posts: 51
Joined: 26 Aug 2009, 13:03
Contact:

20 May 2011, 21:16

Recently, I made a page using PF 3.0 M1 and after a while running the application (it has 5 poll components - ), I realise that the client running Firefox 3 or 4 was chewing up the whole cpu. I switched to Chrome just to give a try, I surprisingly saw that the cpu was rounding the same usage as it was when I started to run application on this browser. Not sure what's going on but I'd like to know whether anyone have experimented something similar.

Client running Firefox 3/4, Chomium 11.0.696.68, Ubuntu 10.04 32bit on Intel dual core with 2GB ram.

thanks

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

20 May 2011, 21:36

I read this somewhere before. Is there already an issue created?
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

20 May 2011, 22:05

If you can find the cause, then we can help. Otherwise probably not.

jguerra
Posts: 51
Joined: 26 Aug 2009, 13:03
Contact:

21 May 2011, 01:28

Thanks for your replies!
In the comming days I'll try to break down the page to see if I can get something clear about it.

Anyways, I posted the whole page just in the case you could spot something I made wrong! Thanks for you help and time!!

Code: Select all

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="../templates/ui.xhtml">

	<ui:define name="head">
		<style type="text/css">
			.ui-panel-titlebar {
				text-align:center;
				font-size:16px;
			}
			
			.tng-panel-content .ui-panel-content {
				width:330px;
    			height:40px;
    			padding: 40px 0px;
    			text-align:center;
    			background:#1E2733;
			}
			
			.greenPanelText {
				font-weight:bold;
				font-size:50px;
				color:green;
			}
			
			.orangePanelText {
				
				font-weight:bold;
				font-size:50px;
				color:orange;
			}
			
			.redPanelText {
				font-weight:bold;
				font-size:50px;
				color:red;
			}
			
			.offButton {
				border-width:1px;
				border-color: #000000;
				border-style: solid;
				text-align: center;
				font-weight: bold;
				background: #CC3300;
				color: #FFFFFF;
				width: 100%;
			}

			.onButton {
				border-width:1px;
				border-color: #000000;
				border-style: solid;
				text-align: center;
				font-weight: bold;
				background: #66CC00;
				color: #FFFFFF;
				width: 100%;
			}
			.disabledButton {
				border-width:1px;
				border-color: #000000;
				border-style: solid;
				text-align: center;
				font-weight: bold;
				background: #C0C0C0;
				color: #FFFFFF;
				width: 100%;
			}
			
			.restartButton {
				border-width:1px;
				border-color: #000000;
				border-style: solid;
				text-align: center;
				font-weight: bold;
				background: #FF8000;
				color: #FFFFFF;
				width: 100%;
		}
		</style>
	</ui:define>
	
	<ui:define name="content">
	
		<h1 class="title ui-widget-header ui-corner-all">Tracking Control Panel</h1>
		<div class="entry" style="line-height:200%">
        
       		<h2>VME Drive, Diagn, Astro and Gate Startup</h2>
        	<p:separator/>
        	<p:growl id="growl" showDetail="true"/> 
        	<p:tooltip global="true" />
        	<h:form>
        		<p:poll interval="1" global="false" update="vme,labelvme"/>
        		<p:poll interval="5" listener="#{trackingGUIController.updateCpButtons}" global="false" update="growl"/> 
        		<table>
        			<tr>
	        			<td><h:outputLabel title="Start up VMEs ONLY when FTP Service is Active." for="vme" value="VMEs:" style="margin-right:5px" /></td>
	        			<td style="width: 100px"> <p:commandButton id="vme" actionListener="#{trackingGUIController.vmeButton}" value="#{trackingGUIController.vmeStatus}" styleClass="#{trackingGUIController.vmeStyle}"/></td>
	        			<td><h:outputLabel id ="labelvme" value="#{trackingGUIController.vmeMsg}" style="margin-right:5px" /></td>
        			</tr>
        		</table>
        	</h:form>
        	
        	<div style="clear:both" />
        	
        	<h2>Restart Services</h2>
        	<p:separator/>
        	
        	<h:form>
        		<p:poll interval="1" global="false" update="nicsbut,labelnicsbut"/>
        		<table>
        			<tr>
	        			<td><h:outputLabel title="Reset NICS services when it's stuck." for="nicsbut" value="NICS: " style="margin-right:5px" /></td>
	        			<td style="width: 100px"> <p:commandButton id="nicsbut" value="#{trackingGUIController.nicsResetStatus}" styleClass="#{trackingGUIController.nicsResetStyle}" onclick="confirmation.show()" type="button"/> </td>
	        			<td><h:outputLabel id ="labelnicsbut" value="#{trackingGUIController.nicsResetMsg}" style="margin-right:5px" /></td>
        			</tr>
        		</table>
        		<p:confirmDialog message="Are you sure about restarting NICS Service?"  
                	showEffect="puff" hideEffect="explode" header="Restart NICS Service" severity="alert" widgetVar="confirmation">  
                  
        			<p:commandButton value="Yes Sure" update="messages" oncomplete="confirmation.hide()"  
                    	actionListener="#{trackingGUIController.nicsResetButton}" />  
       			 	<p:commandButton value="No" onclick="confirmation.hide()" type="button" />   
                  
    			</p:confirmDialog> 
        	</h:form>
        	
        	<div style="clear:both" />
        	
       		<h2>VME Services Status</h2>
        	<p:separator/>
        	<h:form>
        		<p:poll interval="1" global="false" update="heartbeat,ftp,alarm,command,telemetry"/>
	        	<h:panelGrid columns="2">
	        		<p:panel id="heartbeat" header="Heartbeat Service" styleClass="tng-panel-content" style="margin-top:15px;">
	        			<h:outputText value="#{trackingGUIController.heartbeatStatus}" styleClass="#{trackingGUIController.heartbeatStyle}"/>
	        		</p:panel>
	        		<p:panel id="ftp" header="FTP Service" styleClass="tng-panel-content" style="margin-top:15px;">
	        			<h:outputText value="#{trackingGUIController.ftpStatus}" styleClass="#{trackingGUIController.ftpStyle}"/>
	        		</p:panel>
	        		<p:panel id="alarm" header="Alarm Service" styleClass="tng-panel-content" style="margin-top:15px;">
	        			<h:outputText value="#{trackingGUIController.alarmStatus}" styleClass="#{trackingGUIController.alarmStyle}"/>
	        		</p:panel>
	        		<p:panel id="command" header="Command Service" styleClass="tng-panel-content" style="margin-top:15px;">
	        			<h:outputText value="#{trackingGUIController.commandStatus}" styleClass="#{trackingGUIController.commandStyle}" />
	        		</p:panel>
	        		<p:panel id="telemetry" header="Telemetry Service" styleClass="tng-panel-content" style="margin-top:15px;">
	        			<h:outputText value="#{trackingGUIController.telemetryStatus}" styleClass="#{trackingGUIController.telemetryStyle}" />
	        		</p:panel>
	        	</h:panelGrid>
        	</h:form>
        	<div style="clear:both" />
        
       		<h2>Instrument Service Status</h2>
        	<p:separator/>
        	<h:form>
	        	<p:poll interval="1" global="false" update="nics,lrs"/>
	        	<h:panelGrid columns="2">
	        		<p:panel id="nics" header="NICS Service" styleClass="tng-panel-content" style="margin-top:15px;">
	        			<h:outputText value="#{trackingGUIController.nicsStatus}" styleClass="#{trackingGUIController.nicsStyle}" />
	        		</p:panel>
	        		<p:panel id="lrs" header="LRS Service" styleClass="tng-panel-content" style="margin-top:15px;">
	        			<h:outputText value="#{trackingGUIController.lrsStatus}" styleClass="#{trackingGUIController.lrsStyle}" />
	        		</p:panel>
	        	</h:panelGrid>
        	</h:form>
		</div>
	</ui:define>
</ui:composition>

healeyb
Posts: 365
Joined: 07 Apr 2010, 16:05

21 May 2011, 01:56

You don't say much about what you're running but if it was me I'd
start the server in profiling mode and take a look at what's goin
on.

jguerra
Posts: 51
Joined: 26 Aug 2009, 13:03
Contact:

21 May 2011, 12:59

Sorry, the applications is running on glassfish 3.1.

The problem start to be appreciable after 20-30 mins or even more, but if you compare Chromium and Firefox you can realise about this issue quite soon.
This what I have behind scenes controlling the thing is shown below!. Again, I'd appreciate a lot if you could spot a problem on my code to start to digging it.

Thanks

Code: Select all

@ManagedBean(name="trackingGUIController")
@ApplicationScoped
public class TrackingGUIController {
	
	private static final Logger logger = LoggerFactory.getLogger(TrackingGUIController.class);
	
	private static LinkedBlockingQueue<FacesMessage> HomeMessageQueue = new LinkedBlockingQueue<FacesMessage>();
	private static LinkedBlockingQueue<FacesMessage> CPMessageQueue = new LinkedBlockingQueue<FacesMessage>();
	
	/* 1 sec delay for the Ajax feeling */
	private static final int AjaxDelay = 1;
	
	public static final String DisabledButton = "disabledButton";
	public static final String OffButton = "offButton";
	public static final String OnButton = "onButton ";
	public static final String RestartButton = "restartButton";
	public static final String NAStatus = "NA";
	public static final String ONStatus = "ON";
	public static final String OFFStatus = "OFF";
	public static final String RESTARTStatus = "RESTART";
	public static final String BlankMsg = "";
	public static final String WaitingMsg = "Please, wait ...";
	public static final String PanelRedStyle = "redPanelText";
	public static final String PanelGreenStyle = "greenPanelText";
	public static final String PanelOrangeStyle = "orangePanelText";
	
	private boolean firstConnectionClick = true;
	
	private String connectionStyle = DisabledButton;
	private String connectionStatus = NAStatus;
	
	private String serviceStyle = DisabledButton;
	private String serviceStatus = NAStatus;
	private String serviceMsg = BlankMsg;
	
	private String vmeStyle = DisabledButton;
	private String vmeStatus = NAStatus;
	private String vmeMsg = BlankMsg;
	
	private String nicsResetStyle = DisabledButton;
	private String nicsResetStatus = RESTARTStatus;
	private String nicsResetMsg = BlankMsg;
	
	/* Panel initializations */
	private String heartbeatStatus = NAStatus;
	private String heartbeatStyle = PanelOrangeStyle;
	private String ftpStatus = NAStatus;
	private String ftpStyle = PanelOrangeStyle;
	private String commandStatus = NAStatus;
	private String commandStyle = PanelOrangeStyle;
	private String telemetryStatus = NAStatus;
	private String telemetryStyle = PanelOrangeStyle;
	private String alarmStatus = NAStatus;
	private String alarmStyle = PanelOrangeStyle;
	private String NicsStatus = NAStatus;
	private String NicsStyle = PanelOrangeStyle;
	private String LrsStatus = NAStatus;
	private String LrsStyle = PanelOrangeStyle;
	
	private TrackingGUIModel trackingModel;
	
	public TrackingGUIController() {
		
		this.trackingModel = new TrackingGUIModel(this);
	}
	
	public static void addHomeMessage(final FacesMessage message) {
		HomeMessageQueue.add(message);
	}
	
	public static void addCPMessage(final FacesMessage message) {
		CPMessageQueue.add(message);
	}
	
	public void updateHomeButtons() {
		
		if (HomeMessageQueue.size() > 0) {
			
			final FacesMessage msg = HomeMessageQueue.poll();
			
			if (msg != null)
				addGrowlMessage(msg);
		}
	}
	
	public void updateCpButtons() {
		
		if (CPMessageQueue.size() > 0) {
			logger.debug("Found {} queue messages.", CPMessageQueue.size());
			
			final FacesMessage msg = CPMessageQueue.poll();
			
			if (msg != null)
				addGrowlMessage(msg);
		}
	}
	
	public String getConnectionStyle() {
		
		return connectionStyle;
	}
	
	public void setConnectionStyle(String stl) {
		
		this.connectionStyle = stl;
	}

	public String getConnectionStatus() {
		
		return connectionStatus; 
	}
	
	public void setConnectionStatus(String status) {
		this.connectionStatus = status;
	}
	
	public String getServiceStyle() {
		
		return serviceStyle;
	}
	
	public void setServiceStyle(String stl) {
		
		this.serviceStyle = stl;
	}
	
	public String getServiceStatus() {
		return serviceStatus;
	}
	
	public void setServiceStatus(String status) {
		this.serviceStatus = status;
	}
	
	/**
	 * @return the serviceMsg
	 */
	public String getServiceMsg() {
		return serviceMsg;
	}

	/**
	 * @param serviceMsg the serviceMsg to set
	 */
	public void setServiceMsg(String serviceMsg) {
		this.serviceMsg = serviceMsg;
	}

	/**
	 * @return the vmeMsg
	 */
	public String getVmeMsg() {
		return vmeMsg;
	}

	/**
	 * @param vmeMsg the vmeMsg to set
	 */
	public void setVmeMsg(String vmeMsg) {
		this.vmeMsg = vmeMsg;
	}

	public String getVmeStatus() {
		return this.vmeStatus;
	}
	
	public void setVmeStatus(final String status) {
		this.vmeStatus = status;
	}
	
	public String getVmeStyle() {
		return this.vmeStyle;
	}
	
	public void setVmeStyle(final String style) {
		this.vmeStyle = style;
	}
	
	/**
	 * @return the nicsResetStyle
	 */
	public String getNicsResetStyle() {
		return nicsResetStyle;
	}

	/**
	 * @param nicsResetStyle the nicsResetStyle to set
	 */
	public void setNicsResetStyle(String nicsResetStyle) {
		this.nicsResetStyle = nicsResetStyle;
	}

	/**
	 * @return the nicsResetStatus
	 */
	public String getNicsResetStatus() {
		return nicsResetStatus;
	}

	/**
	 * @param nicsResetStatus the nicsResetStatus to set
	 */
	public void setNicsResetStatus(String nicsResetStatus) {
		this.nicsResetStatus = nicsResetStatus;
	}

	/**
	 * @return the nicsResetMsg
	 */
	public String getNicsResetMsg() {
		return nicsResetMsg;
	}

	/**
	 * @param nicsResetMsg the nicsResetMsg to set
	 */
	public void setNicsResetMsg(String nicsResetMsg) {
		this.nicsResetMsg = nicsResetMsg;
	}

	/**
	 * @return the heartbeatStatus
	 */
	public String getHeartbeatStatus() {
		return heartbeatStatus;
	}

	/**
	 * @param heartbeatStatus the heartbeatStatus to set
	 */
	public void setHeartbeatStatus(String heartbeatStatus) {
		this.heartbeatStatus = heartbeatStatus;
	}

	/**
	 * @return the heartbeatStyle
	 */
	public String getHeartbeatStyle() {
		return heartbeatStyle;
	}

	/**
	 * @param heartbeatStyle the heartbeatStyle to set
	 */
	public void setHeartbeatStyle(String heartbeatStyle) {
		this.heartbeatStyle = heartbeatStyle;
	}

	/**
	 * @return the ftpStatus
	 */
	public String getFtpStatus() {
		return ftpStatus;
	}

	/**
	 * @param ftpStatus the ftpStatus to set
	 */
	public void setFtpStatus(String ftpStatus) {
		this.ftpStatus = ftpStatus;
	}

	/**
	 * @return the ftpStyle
	 */
	public String getFtpStyle() {
		return ftpStyle;
	}

	/**
	 * @param ftpStyle the ftpStyle to set
	 */
	public void setFtpStyle(String ftpStyle) {
		this.ftpStyle = ftpStyle;
	}

	/**
	 * @return the commandStatus
	 */
	public String getCommandStatus() {
		return commandStatus;
	}

	/**
	 * @param commandStatus the commandStatus to set
	 */
	public void setCommandStatus(String commandStatus) {
		this.commandStatus = commandStatus;
	}

	/**
	 * @return the commandStyle
	 */
	public String getCommandStyle() {
		return commandStyle;
	}

	/**
	 * @param commandStyle the commandStyle to set
	 */
	public void setCommandStyle(String commandStyle) {
		this.commandStyle = commandStyle;
	}

	/**
	 * @return the telemetryStatus
	 */
	public String getTelemetryStatus() {
		return telemetryStatus;
	}

	/**
	 * @param telemetryStatus the telemetryStatus to set
	 */
	public void setTelemetryStatus(String telemetryStatus) {
		this.telemetryStatus = telemetryStatus;
	}

	/**
	 * @return the telemetryStyle
	 */
	public String getTelemetryStyle() {
		return telemetryStyle;
	}

	/**
	 * @param telemetryStyle the telemetryStyle to set
	 */
	public void setTelemetryStyle(String telemetryStyle) {
		this.telemetryStyle = telemetryStyle;
	}

	/**
	 * @return the alarmStatus
	 */
	public String getAlarmStatus() {
		return alarmStatus;
	}

	/**
	 * @param alarmStatus the alarmStatus to set
	 */
	public void setAlarmStatus(String alarmStatus) {
		this.alarmStatus = alarmStatus;
	}

	/**
	 * @return the alarmStyle
	 */
	public String getAlarmStyle() {
		return alarmStyle;
	}

	/**
	 * @param alarmStyle the alarmStyle to set
	 */
	public void setAlarmStyle(String alarmStyle) {
		this.alarmStyle = alarmStyle;
	}

	
	/**
	 * @return the nicsStatus
	 */
	public String getNicsStatus() {
		return NicsStatus;
	}

	/**
	 * @param nicsStatus the nicsStatus to set
	 */
	public void setNicsStatus(String nicsStatus) {
		NicsStatus = nicsStatus;
	}

	/**
	 * @return the nicsStyle
	 */
	public String getNicsStyle() {
		return NicsStyle;
	}

	/**
	 * @param nicsStyle the nicsStyle to set
	 */
	public void setNicsStyle(String nicsStyle) {
		NicsStyle = nicsStyle;
	}

	/**
	 * @return the lrsStatus
	 */
	public String getLrsStatus() {
		return LrsStatus;
	}

	/**
	 * @param lrsStatus the lrsStatus to set
	 */
	public void setLrsStatus(String lrsStatus) {
		LrsStatus = lrsStatus;
	}

	/**
	 * @return the lrsStyle
	 */
	public String getLrsStyle() {
		return LrsStyle;
	}

	/**
	 * @param lrsStyle the lrsStyle to set
	 */
	public void setLrsStyle(String lrsStyle) {
		LrsStyle = lrsStyle;
	}

	public void connectionButton(final ActionEvent actionEvent) {
		
		try {
			
			TimeUnit.SECONDS.sleep(AjaxDelay);
			
		} catch (InterruptedException e) {
			
			logger.error("GUI Controller was interrupted by an external thread.");
			logger.debug("Exception", e);
		}
		
		if (this.firstConnectionClick) {
			
			this.firstConnectionClick = false;
			
			this.connectionStyle = OffButton;
			this.connectionStatus = OFFStatus;
			
			this.serviceStyle = OffButton;
			this.serviceStatus = OFFStatus;
			
			this.vmeStyle = OffButton;
			this.vmeStatus = OFFStatus;
			
			this.nicsResetStyle = RestartButton;
			this.nicsResetStatus = RESTARTStatus;
			
			return;
		}
		
		this.trackingModel.handleConnection();
	}
	
	public void serviceButton(final ActionEvent actionEvent) {
		
		if (this.firstConnectionClick)
			return;
		
		try {
			
			TimeUnit.SECONDS.sleep(AjaxDelay);
			
		} catch (InterruptedException e) {
			
			logger.error("GUI Controller was interrupted by an external thread.");
			logger.debug("Exception", e);
		}
		
		this.trackingModel.handleService();
	}
	
	public void vmeButton(final ActionEvent actionEvent) {
		
		if (this.firstConnectionClick)
			return;
		
		try {
			
			TimeUnit.SECONDS.sleep(AjaxDelay);
			
		} catch (InterruptedException e) {
			
			logger.error("GUI Controller was interrupted by an external thread.");
			logger.debug("Exception", e);
		}
		
		this.trackingModel.handleVmes();
	}
	
	public void nicsResetButton(final ActionEvent actionEvent) {
		
		if (this.firstConnectionClick)
			return;
		
		try {
			
			TimeUnit.SECONDS.sleep(AjaxDelay);
			
		} catch (InterruptedException e) {
			
			logger.error("GUI Controller was interrupted by an external thread.");
			logger.debug("Exception", e);
		}
		
		this.trackingModel.handleResetNICS();
	}
	
	/*
	 * Add a new message (Growl) to the queue to be handled by a poll call.
	 */
	private static void addGrowlMessage(final FacesMessage message) {
		FacesContext.getCurrentInstance().addMessage(null, message);
	}
}

jguerra
Posts: 51
Joined: 26 Aug 2009, 13:03
Contact:

23 May 2011, 14:06

I've done some analysis and I can't say anything on the server side. However, on the client side and running the same page on firefox and chromium, and after 6h of test, I ended up with firefox running at ~95% cpu and chromium ~6%. After this, I am going to switch to Chromium. If anyone can experiment something similar,please drop a line.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 21 guests