GWT 请求工厂性能 [英] GWT RequestFactory Performance

查看:20
本文介绍了GWT 请求工厂性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于 RequestFactory 和 GWT 性能的问题.我有一个包含 8 个字段的域实体,它返回大约 1000 个 EntityProxies.请求触发和响应之间的时间约为 20 秒.我做了同样的事情,但返回了 10 个 EntityProxies,时间是 17 秒,几乎相同.

I have a question regarding the performance of RequestFactory and GWT. I have a Domain Entity with 8 fields that returns around 1000 EntityProxies. The time between the request fires and it responds is around 20 seconds. I do the same but returning 10 EntityProxies and the time is 17 seconds, almost the same.

这是因为我在开发模式下工作,还是因为我将代码发布到网络上的时间是一样的?

Is this because I'm working in development mode, or when I release the code to the web the time will be the same?

有什么办法可以提高性能吗?,我只是在读取数据,所以也许只读取不写入的东西可能是解决方案?

Is there any way to improve the performance? , I'm only reading data so perhaps something that only read and doesn't writes may be the solution?

我读了这篇文章,内容与我的问题类似:

I read this post with something similar to my problem:

GWT Requestfactory 性能建议

非常感谢.

PD:我在某处读到一个解决方案可能是在服务器中创建一个 xml,将其发送到客户端并在那里重新创建对象,我不想这样做,因为它真的会改变我的应用程序的设计.

PD: I read somewhere that one solution could be to create an xml in the server, send it to the client and recreate the object there, I don't want to do this because it would really change the design of my app.

推荐答案

感谢大家的帮助,我现在意识到使用请求工厂检索数千条记录可能是一个错误.

Thank you all for the help, I realize now that perhaps using Request Factory to retrieve thousands of records was a mistake.

根据这篇文章,我最初使用定位器来覆盖 isLive() 和 Find() 方法:gwt-requestfactory-performance-suggestions

I initially used a Locator to override isLive() and Find() methods according to this post: gwt-requestfactory-performance-suggestions

响应时间减少到大约 13 秒,但仍然太高.

The response time was reduced to about 13 seconds, but it is still too high.

但我轻松解决了.我没有返回 1000+ Entities ,而是创建了一个新的数据库表,其中每个字段都具有所有相同的字段记录(1000+),并由分隔符连接(每个 db 字段的长度约为 10000 ),并且表中只有一条记录大约有 8 个字段.

But I solved it easily. Instead of returning 1000+ Entities , I created a new database table which each field has all the same field records (1000+) concatenated by a separator (each db field has a length of about 10000 ) and I only have one record in the table with around 8 fields.

像这样:

 Field1           |           Field2          |           Field3         

Field1val;Field1val;Field1val;....... |Field2val;Field2val;Field2val;...... |Field3val;Field3val;Field3val;......

Field1val;Field1val;Field1val;....... | Field2val;Field2val;Field2val;...... | Field3val;Field3val;Field3val;......

我通过 RequestFactory 将 One 记录返回给我的客户端,它大大降低了速度!,大约 1 秒.我在客户端解析这个大字符串,持续时间约为 500 毫秒.因此,现在不再浪费大约 20 秒,而是需要大约 1-2 秒才能完成相同的任务.

I return that One record through RequestFactory to my client and it reduced the speed a lot!, around 1 second. I parse this large String in the client and the duration of that is about 500ms. So instead of wasting around 20 seconds now it takes around 1-2 seconds to accomplish the same.

顺便说一下,我只是显示信息,没有必要插入、删除或更新记录,所以这个解决方案对我有用.

By the way I am only displaying information, it is not necessary to Insert, Delete or Update records so this solution works for me.

我想我可以分享这个解决方案.

Thought I could share this solution.

这篇关于GWT 请求工厂性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆