1) Thank you both for taking a look. 2) Disk (2000 year model) isn't particularly fast but no other processes were doing major I/O, but the drive on my old 386 could probably surpass 20 msgs/sec. 3) I don't think AMQ would have reached rev. 4.x with 20 msgs/sec performance so I don't think revision is the problem. 4) The one line change suggested by Adrian immediately jumped performance over 20X. (async sends) 5) Successive runs produced: 740, 500, 380, 1200, 475, 416, 740, 465, 586 msgs/sec. - much better but quite a large variance 6) I'm very satisfied with this improvement/performance for my current purposes. 7) I figured async sends would improve performance as would other tricks in the forum web pages but didn't feel synchronous sends should be this slow - especially on my local host; something seemed wrong. I should have tried the async send but I figured it would only give perhaps 30% better performance - boy was I wrong. 8) I can live with slow synchronous sends for now. I can now work on optimization after I get my products working together using AMQ. (Make work, then optimize.) 9) Thanks again for taking a look!
Adrian Co wrote: > > Hi, > > Wonder if you can try setting useAsyncSend=true? > > i.e. > > connectionFactory.setUseAsyncSend(true); > > > Rick wrote: >> public class ActiveMqTest { >> >> public ActiveMqTest() { >> } >> /////////////////////////////////////////////////////// >> // Just getting started with ActiveMQ. >> // I must be doing something very wrong to be getting such poor >> performance >> on local sends (21 messages/sec). >> // Please take a quick look and see if there is something obvious. >> // This code is a derivative of HelloWorldProducer at >> http://www.activemq.org/site/hello-world.html. >> // Thank you in advance for any help! >> /////////////////////////////////////////////////////// >> // ActiveMQ version: ActiveMQ 4.0-M4 (per activemq --version) >> // OS, HW: Windows 2000 SP4; 900Mhz Pentium Dell Inspiron 8000 laptop, >> 512MB RAM >> // Broker started on local machine >> // Broker output follows: >> // >> // C:\activemq>bin\activemq >> // ACTIVEMQ_HOME: C:\activemq >> // Loading message broker from: xbean:activemq.xml >> // INFO BrokerService - ActiveMQ 4.0-M4 JMS Message >> Broker (localhost) is starting >> // INFO BrokerService - For help or more information >> please see: http://www.logicblaze.com >> // INFO JDBCPersistenceAdapter - Database driver recognized: >> [apache_derby_embedded_jdbc_driver] >> // INFO JournalPersistenceAdapter - Journal Recovery Started from: >> Active Journal: using 5 x 20.0 Megs at: ..\activemq-data\journal >> // INFO JournalPersistenceAdapter - Journal Recovered: 1 >> message(s) >> in transactions recovered. >> // INFO TransportServerThreadSupport - Listening for connections at: >> tcp://richlaptop:61616 >> // INFO TransportConnector - Accepting connection on: >> tcp://richlaptop:61616 >> // WARN MulticastDiscoveryAgent - brokerName not set >> // INFO TransportServerThreadSupport - Listening for connections at: >> tcp://richlaptop:61617?wireFormat=stomp >> // INFO TransportConnector - Accepting connection on: >> tcp://richlaptop:61617?wireFormat=stomp >> // INFO BrokerService - ActiveMQ JMS Message Broker >> (localhost) started >> // INFO NetworkConnector - Establishing network >> connection >> between vm://localhost?network=true and null at >> failover:tcp://richlaptop:6161 >> // INFO VMTransportFactory - binding to broker: localhost >> // INFO TransportConnector - Accepting connection on: >> vm://localhost >> // INFO ManagementContext - JMX consoles can connect to >> service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi >> // INFO DemandForwardingBridge - Starting a network connection >> between vm://localhost#0 and unconnected has been established. >> // INFO DemandForwardingBridge - Disconnecting loop back >> connection. >> // INFO VMTransportFactory - Shutting down VM connectors >> for >> broker: localhost >> // INFO VMTransportFactory - Shutting down VM connectors >> for >> broker: localhost // >> // >> // C:\activemq\bin>java -version >> // java version "1.5.0_02" >> // Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09) >> // Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing) >> // >> // Method output: >> // Sending 200 messages >> // Sent 200 messages at a rate of 21.13494663425975 messages per second >> // ------------------ NOTES ------------------ >> // If setDeliveryMode to NON_PERSISTENT rate jumps to 995 per second >> // All config files unchanged from installation and all log/data files >> under install dir several months old. >> /////////////////////////////////////////////////////// >> public static void main( String [] args ) { >> javax.jms.Connection connection = null; >> javax.jms.Session session = null; >> try { >> // Setup >> org.apache.activemq.ActiveMQConnectionFactory >> connectionFactory = new >> org.apache.activemq.ActiveMQConnectionFactory( "tcp://localhost:61616" ); >> connection = connectionFactory.createConnection(); >> session = connection.createSession( false, >> javax.jms.Session.AUTO_ACKNOWLEDGE ); >> javax.jms.Destination destination = >> session.createQueue( "TestQueue" >> ); >> javax.jms.MessageProducer producer = >> session.createProducer( >> destination >> ); >> producer.setDeliveryMode( >> javax.jms.DeliveryMode.PERSISTENT ); >> connection.start(); >> // Build and send message numToSend times >> int numToSend = 200; >> javax.jms.TextMessage message = >> session.createTextMessage(); >> System.out.println( "Sending " + numToSend + " >> messages" ); >> System.out.flush(); >> long t1 = System.currentTimeMillis(); >> for ( int i = 0; i < numToSend; ++i ) { >> message.setText( "Message#" + Integer.toString( >> i ) ); >> producer.send( message ); >> } >> long t2 = System.currentTimeMillis(); >> // Compute and print out send rate >> double rate = ( double ) numToSend/( ( double ) ( t2 - >> t1 )/1000.0 ); >> System.out.println( "Sent " + numToSend + " messages at >> a rate of " + >> rate + " messages per second" ); System.out.flush(); >> } >> catch ( Exception eOuter ) { >> eOuter.printStackTrace(); >> } >> finally { >> // Clean up >> try { >> if ( session != null ) session.close(); >> if ( connection != null ) connection.close(); >> } >> catch ( Exception eInner ) { >> eInner.printStackTrace(); >> } >> } >> } >> >> } >> >> > > > -- View this message in context: http://www.nabble.com/AMQ-Beginner---slow-producer-tf2269364.html#a6307503 Sent from the ActiveMQ - User forum at Nabble.com.