|
From: <cle...@jb...> - 2006-06-05 21:01:34
|
You are measuring ClassLoading time of JBossSerialization also.
You should do something like:
| FileOutputStream fileOutputStream=new FileOutputStream(file);
| final ObjectOutputStream out = new JBossObjectOutputStream(fileOutputStream);
| final MyObject event = new MyObject(new Long(9999),new Date(),new Date(),"string1","string2",123,234,true,345);
|
| long firstTimeStamp=0;
|
| for(int i=0;i<20000;i++){
| if (i==1000)
| {
| firstTimeStamp=System.currentTimeMillis();
| }
| out.reset();
| out.writeObject(event);
| out.flush();
| }
|
|
| long timeSpent=System.currentTimeMillis()-firstTimeStamp;
| System.out.println(timeSpent);
|
What really cares in a sytem is a steady state. If you need to measure Loading Time there is no way to compete with Sun JDK's, as I can't modify the JVM to pre-load JBossSerialization.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949225#3949225
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949225
|
|
From: liudan2005 <do-...@jb...> - 2006-06-06 08:59:32
|
I've modified my code as you suggested that start counting from 1000th call. Here is the average result I get (The Sun Jdk is about 4 times faster): JBoss Serialization... 5625 ms Sun Serialization... 1415 ms I'm using jdk1.4.2_08 + jboss-serialization-1.0.0.GA Any ideas? View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949293#3949293 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949293 |
|
From: liudan2005 <do-...@jb...> - 2006-06-06 09:11:09
|
tried jboss-serialization-1.0.1.GA and still no luck. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949295#3949295 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949295 |
|
From: <cle...@jb...> - 2006-06-06 12:59:11
|
You need to use a BufferedOutputStream
Even javaSerialization works better with the Buffer.
This is because JavaSErialization has an internal buffer. JBossSErialization not.
jboss=330
| java=351
public class MyTest extends TestCase
| {
|
| static class MyObject implements Serializable
| {
|
| Long along;
| Date adate;
| Date anotherdate;
| String astring;
| String anotherstring;
| int a;
| int b;
| boolean somea;
| int c;
| public int getA() {
| return a;
| }
| public void setA(int a) {
| this.a = a;
| }
| public Date getAdate() {
| return adate;
| }
| public void setAdate(Date adate) {
| this.adate = adate;
| }
| public Long getAlong() {
| return along;
| }
| public void setAlong(Long along) {
| this.along = along;
| }
| public Date getAnotherdate() {
| return anotherdate;
| }
| public void setAnotherdate(Date anotherdate) {
| this.anotherdate = anotherdate;
| }
| public String getAnotherstring() {
| return anotherstring;
| }
| public void setAnotherstring(String anotherstring) {
| this.anotherstring = anotherstring;
| }
| public String getAstring() {
| return astring;
| }
| public void setAstring(String astring) {
| this.astring = astring;
| }
| public int getB() {
| return b;
| }
| public void setB(int b) {
| this.b = b;
| }
| public int getC() {
| return c;
| }
| public void setC(int c) {
| this.c = c;
| }
| public boolean isSomea() {
| return somea;
| }
| public void setSomea(boolean somea) {
| this.somea = somea;
| }
| public MyObject(Long along, Date adate, Date anotherdate, String astring, String anotherstring, int a, int b, boolean somea, int c) {
| super();
| this.along = along;
| this.adate = adate;
| this.anotherdate = anotherdate;
| this.astring = astring;
| this.anotherstring = anotherstring;
| this.a = a;
| this.b = b;
| this.somea = somea;
| this.c = c;
| }
| }
|
| public static boolean useBuffer=true;
|
| public void testJBoss() throws Exception
| {
| File file=new File("/tmp/jboss.ser");
| FileOutputStream fileOutputStream=new FileOutputStream(file);
| BufferedOutputStream buffOut = new BufferedOutputStream(fileOutputStream);
| ObjectOutputStream out = null;
| if (useBuffer)
| {
| out = new JBossObjectOutputStream(buffOut);
| }
| else
| {
| out = new JBossObjectOutputStream(fileOutputStream);
| }
| final MyObject event = new MyObject(new Long(9999),new Date(),new Date(),"string1","string2",123,234,true,345);
|
| long firstTimeStamp=0;
|
| for(int i=0;i<20000;i++){
| if (i==1000)
| {
| firstTimeStamp = System.currentTimeMillis();
| }
| out.reset();
| out.writeObject(event);
| out.flush();
| }
|
|
| long timeSpent=System.currentTimeMillis()-firstTimeStamp;
| System.out.println("jboss="+timeSpent);
|
|
|
| }
| public void testJava() throws Exception
| {
| File file=new File("/tmp/java.ser");
| FileOutputStream fileOutputStream=new FileOutputStream(file);
| BufferedOutputStream buffOut = new BufferedOutputStream(fileOutputStream);
| ObjectOutputStream out = null;
| if (useBuffer)
| {
| out = new ObjectOutputStream(buffOut);
| }
| else
| {
| out = new ObjectOutputStream(fileOutputStream);
| }
| final MyObject event = new MyObject(new Long(9999),new Date(),new Date(),"string1","string2",123,234,true,345);
|
| long firstTimeStamp=0;
|
| for(int i=0;i<20000;i++){
| if (i==1000)
| {
| firstTimeStamp = System.currentTimeMillis();
| }
| out.reset();
| out.writeObject(event);
| out.flush();
| }
|
|
| long timeSpent=System.currentTimeMillis()-firstTimeStamp;
| System.out.println("java=" + timeSpent);
|
|
|
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949352#3949352
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949352
|
|
From: liudan2005 <do-...@jb...> - 2006-06-06 14:20:20
|
Changing to use BufferedOutputStream and it now flys. JBoss Serialization runs 70% faster than sun jdk's. Great stuff ! Thanks Clebert. Are there any other JBoss Serialization performance turning tips? I can hardly find any document talking about this at moment. View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949377#3949377 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949377 |
|
From: <cle...@jb...> - 2006-06-10 02:52:38
|
Thanks a lot for your post. I'm preparing a docbook for JBossSerialization. Should be ready soon. (in two or three weeks probably). After JBossWorld. (I'm kind of too busy now becuase of that). Meanwhile I have my blog post aboug jboss serialization: http://jboss.org/jbossBlog/blog/clebert/ View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3950232#3950232 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3950232 |
|
From: slump <do-...@jb...> - 2006-07-06 05:52:44
|
Hi, clebert: I just copy your code and run the test but the result is: jboss=644 java=557 I have run it more than 10 times , the reuslt is similar I use RHEL4 and jdk 1.5.0_06 is there something I missed? and I found that if there isn't log4j.properties, the jboss code become very slow (2333ms), so I think you should put the note in the README View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3955724#3955724 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3955724 |
|
From: <cle...@jb...> - 2006-07-06 22:25:29
|
aha.... maybe they fixed their stuff: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5056445 View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956020#3956020 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956020 |