[flexcoders] Re: Streaming BlazeDS connection reverting to polling
Converting BlazeDS to an NIO implementation is terribly interesting for me. I'm building a GIS tracking app that will need to handle more than a couple hundred connections. I knew that blocking IO code was BlazeDS' bottleneck but a $20,000 LCDS license isn't in my company's budget. I've heard that BlazeDS' messaging can scale via server clustering and hardware multiplexing but I'm wondering if you have any experience converting BlazeDS to NIO and if so if you were willing to share how you did it. --- In flexcoders@yahoogroups.com, Anatole Tartakovsky [EMAIL PROTECTED] wrote: It is 10 - please check the source of the BlazeDS source - can be increased to few hundreds in your configuration but you might want to consider setting process affinity and set up LCDS 2.6 express NIO HTTP adapter to really scale it up. Other option is to modify BlazeDS code to not keep the connection and enable NIO adapter on WebContainer/ move connection management into the custom endpoint - then you can scale blazeDS up to few thousand connections.Regards, Anatole Tartakovsky On Thu, Jun 5, 2008 at 5:03 PM, Geoffrey [EMAIL PROTECTED] wrote: I know there is a hardware imposed limitation to the number of BlazeDS real-time streaming connections that you can establish. I've heard it's in the hundreds, so I'm trying to see how many I can connect to my server(WinXP Pro 64-bit with two 3GHz Xeon CPUs and 8GB of RAM). Oddly enough after the 10th client logs in, all subsequent logins revert to a polling connection. Is there some limit on the number of streaming connections you can have before they fall back to polling? Something else I'm missing? BTW, even with polling I can establish 200 connections and the server barely blinks except for an increase in CPU usage due to all of that polling. Thanks, Geoff
[flexcoders] BlazeDS streaming AMF question
Hi, I've updated my BlazeDS version to the nightly build for Thursday May 8 2008 and I'm noticing that blaze is printing a message/warning to console whenever my flex client subscribes to my streamingAMF messaging destination. It looks like this: 09:27:31,375 INFO [STDOUT] [BlazeDS] Endpoint with id 'my-streaming-amf' cannot service the streaming request as either the supplied FlexClient id 'null is not valid, or the FlexClient with that id is not valid. My flex client which subscribes via streaming AMF is still receiving messages from BlazeDS so I'm not too concerned but I am puzzled as to what this message means. Any insight would be appreciated.
[flexcoders] MessageBroker won't return control after routeMessageToService()
Well, Here is the report after I've traced the errors down. I've noticed that when my custom java message adapter halts BlazeDS' messaging still runs. Several diagnostic applications indicate the durability of BlazeDS messaging. I have however tracked down the source the halting of my java message adapter thread to be the MessageBroker... My custom message adapter is multithreaded in that it manages two tasks: One thread listens for messages from a server and then starts a fire-and-forget messaging thread that then packages and routes the message into an AsyncMessage for broadcast to BlazeDS before dying. Traces indicate that after about 6 days of reliable message routing the messaging threads generated by my listener thread start halting at the msgBroker.routeMessageToService(msg, null); method call. (Trace statements to console halt after Trying to routeMessageToService). public void sendMessage() { System.out.println(name+ Connecting to MessageBroker); msgBroker = MessageBroker.getMessageBroker(null); System.out.println(MessageBroker.getId() = +msgBroker.getId()); String clientID = UUIDUtils.createUUID(false); msg.setClientId(clientID); msg.setMessageId(UUIDUtils.createUUID(false)); msg.setTimestamp(System.currentTimeMillis()); System.out.println(name+ Trying to routeMessageToService); msgBroker.routeMessageToService(msg, null); System.out.println(name+ Successful message route); } That is to say that msgBroker's routeMessageToService() method call is not returning and the messaging threads are all halting and piling up in the JVM. After about 4000 of these halted messaging threads piling up the JVM runs out of memory and the listener thread can't instantiate any more messaging threads and the whole thing comes to a halt. You can say that my problem is thus: MessageBroker's routeMessageToService() method stops returning control to my message thread after about 6 days halting it until the unsent message threads pile up leading up to an out of memory crash. I'm working on a fix that will kill the halted message thread if it runs longer than a few seconds. This should aleviate the thread traffic jam but I don't know if the MessageBroker will start routing messages again. I don't know why it stops either. Hope you could shed some light on this. Best, Justin --- In flexcoders@yahoogroups.com, Justin Fujita [EMAIL PROTECTED] wrote: Thanks Mete, I really appreciate your help. I've changed up my java message producer a bit to see if that helps as well. I guess I'll let you know how it works out in about 5-6 days Thanks again, -Justin On Tue, Apr 22, 2008 at 11:15 AM, meteatamel [EMAIL PROTECTED] wrote: I've added some info to the bug report. Please take a look. -Mete --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, jfujita1 justin.fujita@ wrote: Hi, I've built a GIS FLEX application that uses blazeDS' messaging capability to push location (latitude/longitude/geocode) info to flex clients. The message producer is a custom Java bootstrapper and adapter that configures the messaging destination endpoints upon server startup. The destination runtime config java bootstrap method for our fleet_demo destination looks like this: public void initializeDestinations() { String destinationId = fleet_demo; String serviceId = message-service; MessageBroker broker = MessageBroker.getMessageBroker(null); MessageService service = (MessageService) broker.getService(serviceId); MessageDestination destination = (MessageDestination) service.createDestination(destinationId); destination.addChannel(my-streaming-amf); destination.addChannel(my-polling-amf); ServerSettings serverSettings = new ServerSettings(); serverSettings.setMaxCacheSize(1000); serverSettings.setMessageTTL(0); serverSettings.setDurable(false); destination.setServerSettings(serverSettings); if (service.isStarted()) { //initialize and run the destination destination.start(); } } The bootstrapper also spawns a separate thread that continuously receives location data from our server and packages it into an AsyncMessage and routes it to the appropriate destination using a method similar to this: private void sendMessage(latitudeFromServer:double, longitudeFromServer:double) { MessageBroker msgBroker = MessageBroker.getMessageBroker(null); String clientID = UUIDUtils.createUUID(false); AsyncMessage msg = new AsyncMessage(); msg.setDestination(fleet_demo); msg.setHeader(latitude, latitudeFromServer); msg.setHeader(longitude, longitudeFromServer); msg.setClientId(clientID); msg.setMessageId(UUIDUtils.createUUID(false)); msg.setTimestamp(System.currentTimeMillis()); msgBroker.routeMessageToService(msg, null); } Now I start up the server and the bootstrapper initializes the fleet_demo endpoint
[flexcoders] Jboss + BlazeDS + Custom Java message producer = 5 to 6 days of up time
Hi, I've built a GIS FLEX application that uses blazeDS' messaging capability to push location (latitude/longitude/geocode) info to flex clients. The message producer is a custom Java bootstrapper and adapter that configures the messaging destination endpoints upon server startup. The destination runtime config java bootstrap method for our fleet_demo destination looks like this: public void initializeDestinations() { String destinationId = fleet_demo; String serviceId = message-service; MessageBroker broker = MessageBroker.getMessageBroker(null); MessageService service = (MessageService) broker.getService(serviceId); MessageDestination destination = (MessageDestination) service.createDestination(destinationId); destination.addChannel(my-streaming-amf); destination.addChannel(my-polling-amf); ServerSettings serverSettings = new ServerSettings(); serverSettings.setMaxCacheSize(1000); serverSettings.setMessageTTL(0); serverSettings.setDurable(false); destination.setServerSettings(serverSettings); if (service.isStarted()) { //initialize and run the destination destination.start(); } } The bootstrapper also spawns a separate thread that continuously receives location data from our server and packages it into an AsyncMessage and routes it to the appropriate destination using a method similar to this: private void sendMessage(latitudeFromServer:double, longitudeFromServer:double) { MessageBroker msgBroker = MessageBroker.getMessageBroker(null); String clientID = UUIDUtils.createUUID(false); AsyncMessage msg = new AsyncMessage(); msg.setDestination(fleet_demo); msg.setHeader(latitude, latitudeFromServer); msg.setHeader(longitude, longitudeFromServer); msg.setClientId(clientID); msg.setMessageId(UUIDUtils.createUUID(false)); msg.setTimestamp(System.currentTimeMillis()); msgBroker.routeMessageToService(msg, null); } Now I start up the server and the bootstrapper initializes the fleet_demo endpoint and the sendMessage thread routes location data perfectly to my flex client(averaging about 500-1600 messages per hour) It works! This keeps up for about 5-6 days. After that I stop receiving any messages when I should be. Its as though the MessageBrokerServlet just goes silent. The only way to fix this is to restart jboss and when I try to shutdown the server I get this NPE message from the MessageBrokerServlet: 11:22:36,295 INFO [Server] Runtime shutdown hook called, forceHalt: true 11:22:36,295 INFO [Server] JBoss SHUTDOWN: Undeploying all packages 11:22:36,296 INFO [TomcatDeployer] undeploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/ 11:22:36,330 INFO [TomcatDeployer] undeploy, ctxPath=/enterprise, warUrl=.../deploy/enterprise.war/ 11:22:36,331 INFO [StandardWrapper] Waiting for 5 instance(s) to be deallocated 11:22:37,350 INFO [StandardWrapper] Waiting for 5 instance(s) to be deallocated 11:22:38,373 INFO [StandardWrapper] Waiting for 3 instance(s) to be deallocated 11:22:38,512 ERROR [[MessageBrokerServlet]] Servlet.service() for servlet MessageBrokerServlet threw exception java.lang.NullPointerException at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.handleFlexClientStreamingOpenRequest(BaseStreamingHTTPEndpoint.java:959) at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.serviceStreamingRequest(BaseStreamingHTTPEndpoint.java:1131) at flex.messaging.endpoints.BaseStreamingHTTPEndpoint.service(BaseStreamingHTTPEndpoint.java:468) at flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java:377) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at
[flexcoders] Deploying FLEX *.swf's and LCDS services on two separate servers
Hi, I've been building and debugging my flex/LCDS application on my local machine using Jrun to host my swf's and the LCDS messaging and Data services that it subscribes to. Now the application is almost done and I'm thinking about deployment. Due to performance concerns I'm trying to separate the swf hosting and LCDS services on two different servers. ie: I want one web application server (jrun or tomcat) to just host the swf and assets. I want another separate web application server to run LCDS (via jrun or tomcat) and handle the RTMP and data management assemblers. The idea is that one server handles the load of hosting the swf/application assets while the other server just concentrates on processing/transmitting RTMP messages and managing data assemblers. My problem is that I can't figure out how to change the compiler/server settings so that the compiled .swf files subscribe to the LCDS services hosted on another server. I'd appreciate it if anybody with experience in this matter would be kind enough to help.
[flexcoders] Data Services createItem() and MYSQL auto_increment keys...
Hi, I'm working with LCDS' Data Services and I have a question regarding a particular use case: Imagine I'm using Data Services' Java Assembler-VO architecture to build a grocery store inventory application. I've got a datagrid displaying all the products stored in a product table in my MYSQL db. Say each product record in the DB has a unique productID (Imagine a barcode number), a product description, and a quantity. The way productID's are generated is by having the DB auto_increment the productID field upon insertion of a new record (the creation of a new product type). Now, on the Data Services side of this I have my DB-Assembler mapping configured to use the productID field as the unique key when managing my Java/Actionscript value objects. Now normally when I want to create a new record in MYSQL with a primary key that is set to auto_increment, I just supply a static placeholder number as that primary key and MYSQL automatically replaces it with the correct index. Now, if I want to allow the user to create a new product record my Assembler requires that I supply a new actionscript VO with a productID Unique to the records that its managing. This is bothering me because I would need to either loop through the items in my local array and find the next productID (with the possibility of a synchronization error) or query the DB to find out what the next productID should be before instantiating a new product VO and committing it to the assembler. The big catch-22 in this is that I can construct my assembler to insert a new Product record into the DB and I can have it find out what the db set the productID to and return that to the user but in order to create a new record, Data Services requires that the flex-end submits a well-formed(with a unique productID) VO to the assembler for creation.
[flexcoders] RTMP works with .mxml but not swf?
I'm deploying my app to the web server and I have a major problem Say I have a messaging destination called fleet_demo set up and broadcasting messages. Say my app is the following: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=init() mx:Consumer id=consumer message=rtmpHandler(event.message)/ mx:Script ![CDATA[ import mx.messaging.messages.IMessage; import mx.controls.Alert; private function init():void { consumer.destination = fleet_demo; consumer.subscribe(); } private function rtmpHandler(message:IMessage):void { Alert.show(Recieved RTMP message, ALERT); } ]] /mx:Script /mx:Application If I deploy this to my webserver as an MXML file, it takes a bit of time to compile when loaded, but the alert windows pop up as it receives the RTMP messages. If I deploy this to my webserver as the compiled SWF file, no RTMP messages are recieved. There is no error message at all, its just as though no RTMP messages are getting received. Why is this? My real flex app is too large to compile at run-time so I need to know why apps deployed as SWF files have this problem receiving RTMP messages. Thanks
[flexcoders] Separate servers for messaging and flex?
Hi, I'm planning on setting up a group of servers for my flex deployment. I would like to have one dedicated LCDS server that I use for RTMP messaging and one dedicated server for hosting the flex web app files (.swf/.mxml/.html). All the LCDS server does is listen to another back-end server and publish via RTMP to destinations. ie: On the LCDS server, I have bootstrapping set up to programatically initialize all the messaging destinations at server startup as well as start a java thread that listens to another server for messages via datagram-socket connection. The listener thread converts the messages from the other server into an AsyncMessage and has LCDS route it to the appropriate destination. In the interest of improving performance, thats all that I want my LCDS server to do. I would like to have A web application server that hosts my flex deliverables (.swf/.mxml) that have consumer objects that subscribe to destinations hosted on the separate LCDS server described above. All examples I have seen with LCDS show LCDS and the web app deployed on the same server. I'm wondering if such an architecture is supported by the LCDS Messaging and Data Management. All of the servers will be on the same LAN so the simple question is: Can a flex app hosted on one server have a Consumer object that subscribes to a messaging destination endpoint hosted on a different server? Thanks in advance for your help. Justin
[flexcoders] creating messaging service destinations at run-time
Hi, I'm wondering if there is a way for the message broker to create a destination if one does not currently exist. Right now I'm using bootstrapping to query a Database and instantiate all of the messaging service destinations upon server startup. If I need to push a message to a destination that does not yet exist, is there a way that I can try to send the message out, capture an error and instantiate the destination then resend the message?
[flexcoders] Building on JMS Chat example in Testdrive server.
I'm working on expanding Christophe Coenraets' JMS chat example on the Testdrive Server for Tomcat... the one located in \fds-tomcat\webapps\ROOT\jms. The example works fine. Both the Flex chat client and the javachat.bat script in \fds-tomcat\bin work fine. I'm trying to edit the java source of the swing-based Chat.java implementation located at \fds-tomcat\webapps\ROOT\WEB-INF\src\flex\samples\jms\Chat.java First of all, I copied the Chat.java into my own workspace and tried to compile it and run it. With the fds-tomcat server runing, this should be the equivalent as running the javachat script in the \fds-tomcat\bin directory right? Instead, I get the following error: javax.naming.NameNotFoundException: JmsConnectionFactory at org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:215) at javax.naming.InitialContext.lookup(Unknown Source) at Chat.init(Chat.java:41) at Chat.main(Chat.java:26) Upon closer inspection of the javachat.bat script, I see the following: @echo off SET WEBINF=..\webapps\ROOT\WEB-INF java -classpath %WEBINF%\lib\flex-messaging.jar;%WEBINF%\lib\geronimo-jms_1.1_spec-1.0.jar;%WEBINF%\lib\activemq-core-4.1.0-incubator.jar;%WEBINF%\lib\backport-util-concurrent.jar;%WEBINF%\lib\commons-logging.jar;%WEBINF%\lib\geronimo-j2ee-management_1.0_spec-1.0.jar;%WEBINF%\classes flex.samples.jms.Chat Which is fine since I imported the same jar files into the java build path in my eclipse sandbox version. Why does the supplied chat.java work while my local sandbox copy fails to locate the connection factory?
[flexcoders] Flex Message Service Java API and Listeners
Hi, I was looking at Christophe Coenraets' Tour Tracker application: http://coenraets.org/blog/2007/02/building-the-back-end-of-the-tour-of-california-%e2%80%9ctour-tracker%e2%80%9d-using-flex-data-services/ and I would like to do something similar to his socket GPS listener Messaging adapter. I assume the listener will be a thread running on the LCDS server that uses the Actionscript message API (As seen in Coenraets'Example #6 Feed in his Testdrive server for Java Developers) to push via RTMP. The problem is, I've not been able to get the Feed example to work without using the supplied startfeed.jsp and stopfeed.jsp servlets. ie: when I take the feed.java source and modify it and run it in my own workspace, java complains that it can't find the MessageBroker: MessageBroker msgBroker = MessageBroker.getMessageBroker(null); Has anybody been able to modify feed.java and/or patch into the MessageBroker LCDS service? I'd be most appreciative for any input regarding this problem.