You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Suchitha Koneru (sukoneru)" <su...@cisco.com> on 2007/04/05 00:12:17 UTC
derby db using up lot of disk space
Hello Active MQ Users,
I am using active mq 4.0,.2. I am using a durable
subscriber and topic publisher with non present mode of delivery. The
derby db has grown to be of the size of 13 GB. is this a bug in 4.0.2 ?
has any one of you encountered such a problem. This is using up all the
disk space. Please let me know. The code snippets for publisher and
subscriber are as follows
// publisher code
tc = getConn();
Sess = getSession(tc);
topic = getTopic();
logger.info("the sender topic is :"+topic);
try{
pub = Sess.createPublisher(topic);
if(pub != null){
pub.setTimeToLive(300000);
pub.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
tc.start();
}else{
logger.error("JMS Event sender , publisher is null");
}
// subscriber code
public TopicSubscriber createSubscriber() {
try {
String durableSusbscriptionName =
jmsProperties.getProperty(DURABLE_SUBSCRIPTION_NAME);
Subs = Sess.createDurableSubscriber(topic, durableSusbscriptionName);
Subs.setMessageListener(new JmsMessageListener());
}catch(Exception ex) {
logger.error("Exception while creating subscriber for topic " +
ex.getMessage());
ex.printStackTrace();
}
return Subs;
}
class JmsMessageListener implements MessageListener {
public void onMessage(Message m) {
try {
HerbieEvent evt = null;
if(m instanceof ActiveMQObjectMessage){
ActiveMQObjectMessage obj = (ActiveMQObjectMessage) m;
HerbieEvent event = (HerbieEvent) obj.getObject();
System.out.println(event.getMessage());
}
}
}else {
// Not a relevent Herbie event, ignore
}
}catch(Exception ex) {
logger.error("ERROR: while receiving event "+ex.getMessage());
ex.printStackTrace();
}
}
}
Re: derby db using up lot of disk space
Posted by James Strachan <ja...@gmail.com>.
On 4/5/07, Suchitha Koneru (sukoneru) <su...@cisco.com> wrote:
> Thank you James and Hemant for the information.
> I am using an embedded broker in Tomcat 5.520. The embedded broker is
> started by a servlet context listener.
>
>
>
> Is there a way I can access the derby db , which is internally
> maintained by the active mq embedded broker ?
No, unless via java code thats embedded
> Also, In case of a embedded broker, how will I switch to a different
> data base (MySQl or PsotGreSQl).
> Please give a link to relevant documentation.
Use the xml config; see the activemq.xml in the release
http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html
>
>
>
>
> Thanks,
> Suchitha
>
>
> -----Original Message-----
> From: Hemant Gaur [mailto:hgaur@interwoven.com]
> Sent: Thursday, April 05, 2007 6:44 AM
> To: users@activemq.apache.org
> Subject: RE: derby db using up lot of disk space
>
> Derby DB used for long time/more publishes needs to be compressed even
> when the tables have lesser data.
> A Derby table or index (sometimes called a conglomerate) can contain
> unused space after large amounts of data have been deleted or updated.
> This happens because, by default, Derby does not return unused space to
> the operating system. After a page has been allocated to a table or
> index, Derby does not automatically return the page to the operating
> system until the table or index is dropped, even if the space is no
> longer needed.
> However, Derby does provide a way to reclaim unused space in tables and
> associated indexes.
> ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('USR', 'MESSAGES', 1);
> 0 rows inserted/updated/deleted
> ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('USR', 'MESSAGE_HANDLES', 1);
> 0 rows inserted/updated/deleted
>
> --hemant gaur
>
>
> -----Original Message-----
> From: James Strachan [mailto:james.strachan@gmail.com]
> Sent: Thursday, April 05, 2007 6:35 PM
> To: users@activemq.apache.org
> Subject: Re: derby db using up lot of disk space
>
> I'd recommend switching to a more traditional database like MySQL or
> Postgresql for production usage. Or switch to AMQStore in 4.2
>
> On 4/4/07, Suchitha Koneru (sukoneru) <su...@cisco.com> wrote:
> > Hello Active MQ Users,
> > I am using active mq 4.0,.2. I am using a durable
>
> > subscriber and topic publisher with non present mode of delivery. The
> > derby db has grown to be of the size of 13 GB. is this a bug in 4.0.2
> ?
> > has any one of you encountered such a problem. This is using up all
> the
> > disk space. Please let me know. The code snippets for publisher and
> > subscriber are as follows
> >
> > // publisher code
> > tc = getConn();
> >
> > Sess = getSession(tc);
> >
> > topic = getTopic();
> >
> > logger.info("the sender topic is :"+topic);
> >
> > try{
> >
> > pub = Sess.createPublisher(topic);
> >
> > if(pub != null){
> >
> > pub.setTimeToLive(300000);
> >
> > pub.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
> >
> > tc.start();
> >
> > }else{
> >
> > logger.error("JMS Event sender , publisher is null");
> >
> > }
> >
> > // subscriber code
> > public TopicSubscriber createSubscriber() {
> >
> > try {
> >
> > String durableSusbscriptionName =
> > jmsProperties.getProperty(DURABLE_SUBSCRIPTION_NAME);
> >
> > Subs = Sess.createDurableSubscriber(topic, durableSusbscriptionName);
> >
> > Subs.setMessageListener(new JmsMessageListener());
> >
> > }catch(Exception ex) {
> >
> > logger.error("Exception while creating subscriber for topic " +
> > ex.getMessage());
> >
> > ex.printStackTrace();
> >
> > }
> >
> > return Subs;
> >
> > }
> >
> > class JmsMessageListener implements MessageListener {
> >
> > public void onMessage(Message m) {
> >
> > try {
> >
> > HerbieEvent evt = null;
> >
> > if(m instanceof ActiveMQObjectMessage){
> >
> > ActiveMQObjectMessage obj = (ActiveMQObjectMessage) m;
> >
> > HerbieEvent event = (HerbieEvent) obj.getObject();
> >
> > System.out.println(event.getMessage());
> >
> > }
> >
> > }
> >
> > }else {
> >
> > // Not a relevent Herbie event, ignore
> >
> > }
> >
> > }catch(Exception ex) {
> >
> > logger.error("ERROR: while receiving event "+ex.getMessage());
> >
> > ex.printStackTrace();
> >
> > }
> >
> > }
> >
> > }
> >
> >
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
--
James
-------
http://radio.weblogs.com/0112098/
RE: derby db using up lot of disk space
Posted by Hemant Gaur <hg...@interwoven.com>.
>> Is there a way I can access the derby db , which is internally
maintained by the active mq embedded broker ?
Yes, U can use ij command line tool or Squirrel which is JDBC driven
generic RDBMS UI environment.
>>Also, In case of a embedded broker, how will I switch to a different
data base (MySQl or PsotGreSQl).
Below are the steps on how to configure a new database. There are two DB
tables
Journal example is
<journaledJDBC journalLogFiles="5" dataDirectory="../activemq-data"
dataSource="#mssql-ds"> <adapter><imageBasedJDBCAdaptor/></adapter>
</journaledJDBC>
Non Journal example is
<jdbcPersistenceAdapter dataSource="#mssql-ds"/
1. Modify activemq.xml found in the directory "activemq_home/conf" by
editing or adding a JDBC DataSource Configuration.
e.g.
<bean id="mysql-ds" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/activemq"/>
<property name="username" value="activemq"/>
<property name="password" value="activemq"/>
<property name="poolPreparedStatements" value="true"/>
</bean>
2. Set the datasource reference to use the new jdbc configuration e.g
<jdbcPersistence dataSourceRef="mssql-ds"/>
3. Place the jdbc driver in the directory "activemq_home/lib/optional".
You can get more detaild from the product documentations.
--hemant
-----Original Message-----
From: Suchitha Koneru (sukoneru) [mailto:sukoneru@cisco.com]
Sent: Thursday, April 05, 2007 11:36 PM
To: users@activemq.apache.org
Subject: RE: derby db using up lot of disk space
Thank you James and Hemant for the information.
I am using an embedded broker in Tomcat 5.520. The embedded broker is
started by a servlet context listener.
Is there a way I can access the derby db , which is internally
maintained by the active mq embedded broker ?
Also, In case of a embedded broker, how will I switch to a different
data base (MySQl or PsotGreSQl).
Please give a link to relevant documentation.
Thanks,
Suchitha
-----Original Message-----
From: Hemant Gaur [mailto:hgaur@interwoven.com]
Sent: Thursday, April 05, 2007 6:44 AM
To: users@activemq.apache.org
Subject: RE: derby db using up lot of disk space
Derby DB used for long time/more publishes needs to be compressed even
when the tables have lesser data.
A Derby table or index (sometimes called a conglomerate) can contain
unused space after large amounts of data have been deleted or updated.
This happens because, by default, Derby does not return unused space to
the operating system. After a page has been allocated to a table or
index, Derby does not automatically return the page to the operating
system until the table or index is dropped, even if the space is no
longer needed.
However, Derby does provide a way to reclaim unused space in tables and
associated indexes.
ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('USR', 'MESSAGES', 1);
0 rows inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('USR', 'MESSAGE_HANDLES', 1);
0 rows inserted/updated/deleted
--hemant gaur
-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com]
Sent: Thursday, April 05, 2007 6:35 PM
To: users@activemq.apache.org
Subject: Re: derby db using up lot of disk space
I'd recommend switching to a more traditional database like MySQL or
Postgresql for production usage. Or switch to AMQStore in 4.2
On 4/4/07, Suchitha Koneru (sukoneru) <su...@cisco.com> wrote:
> Hello Active MQ Users,
> I am using active mq 4.0,.2. I am using a durable
> subscriber and topic publisher with non present mode of delivery. The
> derby db has grown to be of the size of 13 GB. is this a bug in 4.0.2
?
> has any one of you encountered such a problem. This is using up all
the
> disk space. Please let me know. The code snippets for publisher and
> subscriber are as follows
>
> // publisher code
> tc = getConn();
>
> Sess = getSession(tc);
>
> topic = getTopic();
>
> logger.info("the sender topic is :"+topic);
>
> try{
>
> pub = Sess.createPublisher(topic);
>
> if(pub != null){
>
> pub.setTimeToLive(300000);
>
> pub.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>
> tc.start();
>
> }else{
>
> logger.error("JMS Event sender , publisher is null");
>
> }
>
> // subscriber code
> public TopicSubscriber createSubscriber() {
>
> try {
>
> String durableSusbscriptionName =
> jmsProperties.getProperty(DURABLE_SUBSCRIPTION_NAME);
>
> Subs = Sess.createDurableSubscriber(topic, durableSusbscriptionName);
>
> Subs.setMessageListener(new JmsMessageListener());
>
> }catch(Exception ex) {
>
> logger.error("Exception while creating subscriber for topic " +
> ex.getMessage());
>
> ex.printStackTrace();
>
> }
>
> return Subs;
>
> }
>
> class JmsMessageListener implements MessageListener {
>
> public void onMessage(Message m) {
>
> try {
>
> HerbieEvent evt = null;
>
> if(m instanceof ActiveMQObjectMessage){
>
> ActiveMQObjectMessage obj = (ActiveMQObjectMessage) m;
>
> HerbieEvent event = (HerbieEvent) obj.getObject();
>
> System.out.println(event.getMessage());
>
> }
>
> }
>
> }else {
>
> // Not a relevent Herbie event, ignore
>
> }
>
> }catch(Exception ex) {
>
> logger.error("ERROR: while receiving event "+ex.getMessage());
>
> ex.printStackTrace();
>
> }
>
> }
>
> }
>
>
>
--
James
-------
http://radio.weblogs.com/0112098/
RE: derby db using up lot of disk space
Posted by "Suchitha Koneru (sukoneru)" <su...@cisco.com>.
Thank you James and Hemant for the information.
I am using an embedded broker in Tomcat 5.520. The embedded broker is
started by a servlet context listener.
Is there a way I can access the derby db , which is internally
maintained by the active mq embedded broker ?
Also, In case of a embedded broker, how will I switch to a different
data base (MySQl or PsotGreSQl).
Please give a link to relevant documentation.
Thanks,
Suchitha
-----Original Message-----
From: Hemant Gaur [mailto:hgaur@interwoven.com]
Sent: Thursday, April 05, 2007 6:44 AM
To: users@activemq.apache.org
Subject: RE: derby db using up lot of disk space
Derby DB used for long time/more publishes needs to be compressed even
when the tables have lesser data.
A Derby table or index (sometimes called a conglomerate) can contain
unused space after large amounts of data have been deleted or updated.
This happens because, by default, Derby does not return unused space to
the operating system. After a page has been allocated to a table or
index, Derby does not automatically return the page to the operating
system until the table or index is dropped, even if the space is no
longer needed.
However, Derby does provide a way to reclaim unused space in tables and
associated indexes.
ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('USR', 'MESSAGES', 1);
0 rows inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('USR', 'MESSAGE_HANDLES', 1);
0 rows inserted/updated/deleted
--hemant gaur
-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com]
Sent: Thursday, April 05, 2007 6:35 PM
To: users@activemq.apache.org
Subject: Re: derby db using up lot of disk space
I'd recommend switching to a more traditional database like MySQL or
Postgresql for production usage. Or switch to AMQStore in 4.2
On 4/4/07, Suchitha Koneru (sukoneru) <su...@cisco.com> wrote:
> Hello Active MQ Users,
> I am using active mq 4.0,.2. I am using a durable
> subscriber and topic publisher with non present mode of delivery. The
> derby db has grown to be of the size of 13 GB. is this a bug in 4.0.2
?
> has any one of you encountered such a problem. This is using up all
the
> disk space. Please let me know. The code snippets for publisher and
> subscriber are as follows
>
> // publisher code
> tc = getConn();
>
> Sess = getSession(tc);
>
> topic = getTopic();
>
> logger.info("the sender topic is :"+topic);
>
> try{
>
> pub = Sess.createPublisher(topic);
>
> if(pub != null){
>
> pub.setTimeToLive(300000);
>
> pub.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>
> tc.start();
>
> }else{
>
> logger.error("JMS Event sender , publisher is null");
>
> }
>
> // subscriber code
> public TopicSubscriber createSubscriber() {
>
> try {
>
> String durableSusbscriptionName =
> jmsProperties.getProperty(DURABLE_SUBSCRIPTION_NAME);
>
> Subs = Sess.createDurableSubscriber(topic, durableSusbscriptionName);
>
> Subs.setMessageListener(new JmsMessageListener());
>
> }catch(Exception ex) {
>
> logger.error("Exception while creating subscriber for topic " +
> ex.getMessage());
>
> ex.printStackTrace();
>
> }
>
> return Subs;
>
> }
>
> class JmsMessageListener implements MessageListener {
>
> public void onMessage(Message m) {
>
> try {
>
> HerbieEvent evt = null;
>
> if(m instanceof ActiveMQObjectMessage){
>
> ActiveMQObjectMessage obj = (ActiveMQObjectMessage) m;
>
> HerbieEvent event = (HerbieEvent) obj.getObject();
>
> System.out.println(event.getMessage());
>
> }
>
> }
>
> }else {
>
> // Not a relevent Herbie event, ignore
>
> }
>
> }catch(Exception ex) {
>
> logger.error("ERROR: while receiving event "+ex.getMessage());
>
> ex.printStackTrace();
>
> }
>
> }
>
> }
>
>
>
--
James
-------
http://radio.weblogs.com/0112098/
RE: derby db using up lot of disk space
Posted by Hemant Gaur <hg...@interwoven.com>.
Derby DB used for long time/more publishes needs to be compressed even
when the tables have lesser data.
A Derby table or index (sometimes called a conglomerate) can contain
unused space after large amounts of data have been deleted or updated.
This happens because, by default, Derby does not return unused space to
the operating system. After a page has been allocated to a table or
index, Derby does not automatically return the page to the operating
system until the table or index is dropped, even if the space is no
longer needed.
However, Derby does provide a way to reclaim unused space in tables and
associated indexes.
ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('USR', 'MESSAGES', 1);
0 rows inserted/updated/deleted
ij> call SYSCS_UTIL.SYSCS_COMPRESS_TABLE('USR', 'MESSAGE_HANDLES', 1);
0 rows inserted/updated/deleted
--hemant gaur
-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com]
Sent: Thursday, April 05, 2007 6:35 PM
To: users@activemq.apache.org
Subject: Re: derby db using up lot of disk space
I'd recommend switching to a more traditional database like MySQL or
Postgresql for production usage. Or switch to AMQStore in 4.2
On 4/4/07, Suchitha Koneru (sukoneru) <su...@cisco.com> wrote:
> Hello Active MQ Users,
> I am using active mq 4.0,.2. I am using a durable
> subscriber and topic publisher with non present mode of delivery. The
> derby db has grown to be of the size of 13 GB. is this a bug in 4.0.2
?
> has any one of you encountered such a problem. This is using up all
the
> disk space. Please let me know. The code snippets for publisher and
> subscriber are as follows
>
> // publisher code
> tc = getConn();
>
> Sess = getSession(tc);
>
> topic = getTopic();
>
> logger.info("the sender topic is :"+topic);
>
> try{
>
> pub = Sess.createPublisher(topic);
>
> if(pub != null){
>
> pub.setTimeToLive(300000);
>
> pub.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>
> tc.start();
>
> }else{
>
> logger.error("JMS Event sender , publisher is null");
>
> }
>
> // subscriber code
> public TopicSubscriber createSubscriber() {
>
> try {
>
> String durableSusbscriptionName =
> jmsProperties.getProperty(DURABLE_SUBSCRIPTION_NAME);
>
> Subs = Sess.createDurableSubscriber(topic, durableSusbscriptionName);
>
> Subs.setMessageListener(new JmsMessageListener());
>
> }catch(Exception ex) {
>
> logger.error("Exception while creating subscriber for topic " +
> ex.getMessage());
>
> ex.printStackTrace();
>
> }
>
> return Subs;
>
> }
>
> class JmsMessageListener implements MessageListener {
>
> public void onMessage(Message m) {
>
> try {
>
> HerbieEvent evt = null;
>
> if(m instanceof ActiveMQObjectMessage){
>
> ActiveMQObjectMessage obj = (ActiveMQObjectMessage) m;
>
> HerbieEvent event = (HerbieEvent) obj.getObject();
>
> System.out.println(event.getMessage());
>
> }
>
> }
>
> }else {
>
> // Not a relevent Herbie event, ignore
>
> }
>
> }catch(Exception ex) {
>
> logger.error("ERROR: while receiving event "+ex.getMessage());
>
> ex.printStackTrace();
>
> }
>
> }
>
> }
>
>
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: derby db using up lot of disk space
Posted by James Strachan <ja...@gmail.com>.
I'd recommend switching to a more traditional database like MySQL or
Postgresql for production usage. Or switch to AMQStore in 4.2
On 4/4/07, Suchitha Koneru (sukoneru) <su...@cisco.com> wrote:
> Hello Active MQ Users,
> I am using active mq 4.0,.2. I am using a durable
> subscriber and topic publisher with non present mode of delivery. The
> derby db has grown to be of the size of 13 GB. is this a bug in 4.0.2 ?
> has any one of you encountered such a problem. This is using up all the
> disk space. Please let me know. The code snippets for publisher and
> subscriber are as follows
>
> // publisher code
> tc = getConn();
>
> Sess = getSession(tc);
>
> topic = getTopic();
>
> logger.info("the sender topic is :"+topic);
>
> try{
>
> pub = Sess.createPublisher(topic);
>
> if(pub != null){
>
> pub.setTimeToLive(300000);
>
> pub.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
>
> tc.start();
>
> }else{
>
> logger.error("JMS Event sender , publisher is null");
>
> }
>
> // subscriber code
> public TopicSubscriber createSubscriber() {
>
> try {
>
> String durableSusbscriptionName =
> jmsProperties.getProperty(DURABLE_SUBSCRIPTION_NAME);
>
> Subs = Sess.createDurableSubscriber(topic, durableSusbscriptionName);
>
> Subs.setMessageListener(new JmsMessageListener());
>
> }catch(Exception ex) {
>
> logger.error("Exception while creating subscriber for topic " +
> ex.getMessage());
>
> ex.printStackTrace();
>
> }
>
> return Subs;
>
> }
>
> class JmsMessageListener implements MessageListener {
>
> public void onMessage(Message m) {
>
> try {
>
> HerbieEvent evt = null;
>
> if(m instanceof ActiveMQObjectMessage){
>
> ActiveMQObjectMessage obj = (ActiveMQObjectMessage) m;
>
> HerbieEvent event = (HerbieEvent) obj.getObject();
>
> System.out.println(event.getMessage());
>
> }
>
> }
>
> }else {
>
> // Not a relevent Herbie event, ignore
>
> }
>
> }catch(Exception ex) {
>
> logger.error("ERROR: while receiving event "+ex.getMessage());
>
> ex.printStackTrace();
>
> }
>
> }
>
> }
>
>
>
--
James
-------
http://radio.weblogs.com/0112098/