将会话转换为字符串并存储在会话变量中,会提高性能吗? [英] Converting session into string and storing in the session variable, will improve perfomence?

查看:141
本文介绍了将会话转换为字符串并存储在会话变量中,会提高性能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我将巨大的数据集存储在会话变量中.这导致了应用程序的性能.由于数据集具有特定于用户的信息,因此无法将这些巨大的数据存储在缓存对象中.
现在,我将此数据集转换为xml并以字符串形式存储到会话中.在检索数据时,我再次将xml字符串转换为数据集.
此举是否可以帮助我改善应用程序的性能?
还有哪些其他选项可以减小用户会话的大小并提高应用程序的性能.

我尝试过的事情:

Hi,

I am storing the huge dataset in the session variable. which is causing the performance of the application. As the dataset has the information which is specific to the user hence cannot store this huge data in cache object.
Now I am converting this dataset into xml and storing into the session as a string. While retrieving the data I am again converting that xml string into dataset.
will this move help me to improve the performance of the application?
What are other options to reduce the size of the user session and improve performance of the application.

What I have tried:

// Convert dataset to string and storing in the session
Session["UserData"] = Ds.GetXml().ToString();

// Convert string to dataset
   DataSet DS = new DataSet() ;
   stream = new StringReader(xmlData);
   reader = new XmlTextReader(stream);
   DS.ReadXml(reader);

推荐答案

通常不使用XML会提高性能,请尝试使用 ^ ]用于数据集序列化.

不保留巨大"数据将是更好的方法.

尝试重新考虑您真正需要存储的内容,除了上述内容之外,我们无法用您提供的少量信息来帮助您.
Generally not using XML will improve performance, try using fastJSON[^] for dataset serialization.

Not holding onto "huge" data will be the better way.

Try rethinking what you really need to store, other than the above we cannot help you with the little information you have provided.


这篇关于将会话转换为字符串并存储在会话变量中,会提高性能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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