Return-Path: X-Original-To: apmail-flex-users-archive@www.apache.org Delivered-To: apmail-flex-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 70DFA1084A for ; Fri, 30 May 2014 15:14:45 +0000 (UTC) Received: (qmail 88496 invoked by uid 500); 30 May 2014 15:14:45 -0000 Delivered-To: apmail-flex-users-archive@flex.apache.org Received: (qmail 88457 invoked by uid 500); 30 May 2014 15:14:45 -0000 Mailing-List: contact users-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@flex.apache.org Delivered-To: mailing list users@flex.apache.org Received: (qmail 88449 invoked by uid 99); 30 May 2014 15:14:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 May 2014 15:14:45 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of flashflexpro@gmail.com designates 209.85.192.51 as permitted sender) Received: from [209.85.192.51] (HELO mail-qg0-f51.google.com) (209.85.192.51) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 May 2014 15:14:42 +0000 Received: by mail-qg0-f51.google.com with SMTP id q107so5622087qgd.24 for ; Fri, 30 May 2014 08:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=1+egez1x08nSuaLB72Mgw2zcwRlCqGPR1uJ469xXX1E=; b=EO64Kjtz0p8d0fIezWV/aLjz2y+7B6wG0nf2ErmjuhobapV0vQpm4KF5sZVulJu0Hn YYicXmmqOFwlkeVHuJkgHS4tjHv1E9zV5FXVt35lQB5wM2hUFiRGUPG8Tg6AKqlIPUMH X05u4GYzy2niAtztQiNDF09LaXxTgvdCxbTMGM1Oq3Tcd5EdoOxr/+lgI26gLPqg//QV weQUkcJ66bR5NVgMQPHEs26MOdEoqWpnMw9PjdcPLxx85NFvhJK2caTZOdJ4U3JWh9Tk w/+C0FCUf3RMH8UZz7k4vrlJt8hCQeX3O8NvcUlSdp9dF7I+9rpkbB6AMNKDNCO4hwd1 qUcg== MIME-Version: 1.0 X-Received: by 10.140.34.228 with SMTP id l91mr20851965qgl.85.1401462857909; Fri, 30 May 2014 08:14:17 -0700 (PDT) Received: by 10.224.117.6 with HTTP; Fri, 30 May 2014 08:14:17 -0700 (PDT) In-Reply-To: References: Date: Fri, 30 May 2014 11:14:17 -0400 Message-ID: Subject: Re: AMF3 Serialization Benchmark (GraniteDS 3.1.0.M1 vs. BlazeDS 4.0.0) From: Gary Yang To: users@flex.apache.org Content-Type: multipart/alternative; boundary=001a11c10010cfebc404fa9f7f50 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c10010cfebc404fa9f7f50 Content-Type: text/plain; charset=UTF-8 Franck, Very impressive! I guess it is time to switch to GraniteDS. Thanks. -Gary On Fri, May 30, 2014 at 4:41 AM, Franck Wolff wrote: > Gary, > > Just have a look at the link I gave you before: > > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java > . > It doesn't run inside a servlet container, does it? > > F. > > > 2014-05-29 17:22 GMT+02:00 Gary Yang : > > > Franck, > > > > Does GraniteDS have to run inside a servlet container? I only want to AMF > > serialization/deserialization function which has nothing to do with > > network, http or servlet. > > > > thanks. > > > > -Gary > > > > > > On Thu, May 29, 2014 at 7:44 AM, Franck Wolff > wrote: > > > > > Gary, > > > > > > See the benchmark classes: > > > > > > > > > > > > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkBlazeDSAmf.java > > > vs. > > > > > > > > > https://github.com/fwolff/amf-benchmark/blob/master/src/org/granite/benchmark/amf/BenchmarkGraniteDSAmf.java > > > > > > GraniteDS needs a bit more configuration, but is still very easy to > use. > > > > > > BTW, about DTOs: you can have a look to our Converter/Reverter feature, > > > even if it isn't meant to be used this way in the first place (see > > > documentation > > > > > > > > > http://www.granitedataservices.com/public/docs/latest/docs/reference/flex/graniteds-refguide-flex.html#extensibility.customtypes > > > ). > > > > > > Let's say you have a bean MyBean on your server and you want to > serialize > > > MyBeanDTO instead (and vice-versa). You can easily write this kind of > > > converter: > > > > > > public class MyBeanConverter extends Converter implements Reverter { > > > > > > public MyBeanConverter(Converters converters) { > > > super(converters); > > > } > > > > > > // AMF3Deserialization (Converter)... > > > > > > @Override > > > protected boolean internalCanConvert(Object value, Type > targetType) { > > > return (value instanceof MyBeanDTO); > > > } > > > > > > @Override > > > protected Object internalConvert(Object value, Type targetType) { > > > MyBean bean = new MyBean(); > > > MyBeanDTO dto = (MyBeanDTO)value; > > > // copy properties from dto to bean... > > > return bean; > > > } > > > > > > // AMF3Serialization (Reverter)... > > > > > > public boolean canRevert(Object value) { > > > return (value instanceof MyBean); > > > } > > > > > > public Object revert(Object value) { > > > MyBeanDTO dto = new MyBeanDTO(); > > > MyBean bean = (MyBean)value; > > > // copy properties from bean to dto... > > > return dto; > > > } > > > } > > > > > > Then, just plug this new converter (along with any others) in your > > > granite-config.xml: > > > > > > > > > > > > > > > > > > > > > > > > According to this configuration, all MyBean instances will be > serialized > > as > > > MyBeanDTOs and all MyBeanDTOs will be deserialized as MyBeans (you > don't > > > need to anything else, your services can return eg. a collection of > > MyBeans > > > it will be serialized as a collection of MyBeanDTOs). Of course, it can > > be > > > a bit restrictive if you want to have different DTOs classes for a same > > > bean class... > > > > > > Franck. > > > > > > > > > 2014-05-29 2:33 GMT+02:00 Gary Yang : > > > > > > > Sounds great! > > > > > > > > Do you think it is possible that I can use the > > > > serialization/deserialization features as simple as using BlazeDS > like > > > > below? > > > > > > > > > > > > in pom.xml : > > > > > > > > > > > > org.springframework.flex > > > > spring-flex-core > > > > > > > > > > > > then in Java file: > > > > > > > > ... ... > > > > > > > > Amf3Output aOut= new Amf3Output(new SerializationContext()); > > > > aOut.setOutputStream( outStream ); > > > > aOut.writeObject(data); > > > > > > > > ... ... > > > > > > > > Amf3Input aIn = new Amf3Input( new SerializationContext() ); > > > > aIn.setInputStream( inputStream ); > > > > data = aIn.readObject(); > > > > > > > > Thanks. > > > > > > > > > > > > - Gary > > > > > > > > > > > > > > > > On Wed, May 14, 2014 at 8:51 AM, Franck Wolff > > > wrote: > > > > > > > > > Hi everybody, > > > > > > > > > > We have just published the benchmark results on the GraniteDS blog: > > > > > > > > > > > > > > > > > > > > http://www.granitedataservices.com/2014/05/14/amf3-benchmark-graniteds-3-1-vs-blazeds-4-0 > > > > > . > > > > > > > > > > Feedback would be very appreciated. > > > > > > > > > > Franck > > > > > @graniteds > > > > > > > > > > > > > > > --001a11c10010cfebc404fa9f7f50--