网络聊天应用 [英] Web Chat application

查看:83
本文介绍了网络聊天应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
i开发了一个使用SignalR的聊天应用程序并集成在website.it工作正常。现在我在聊天时遇到问题我需要将聊天记录存储到Database.But它不会影响性能。我认为Treading是一个选择。任何想法?



谢谢和问候

Binu

Hi i developed a chat application using SignalR and integrate in website.it is working fine.Now i have faced a problem while chatting i need to store chat logs in to Database.But it is not affected the performance.I think Treading is one option.any idea?

Thanks&Regards
Binu

推荐答案

您不必担心简单的聊天应用程序的线程。我之所以这么说是因为聊天帖子通常非常小,无论如何它们都在服务器上,写入数据库的过程将导致持续毫秒的事务。这根本不会影响用户的性能,所以努力可能不值得。

但是,如果你想要超高效,那么线程是一种解决这个问题的方法。一旦服务器收到数据,你总是可以异步地将数据发送到数据库,在这种情况下,用户根本不会看到对性能的影响,服务器也会愉快地哼唱。

您可以阅读本文 [ ^ ]学习C#中的线程基础知识
You shouldn''t need to worry about threading for a simple chat application. The reason I say this is because chat posts are usually pretty small and once they are on the server anyway, the process of writing to a database will result in a transaction lasting milliseconds. This wouldn''t affect user performance at all, so the effort may not be worth the benefit.
However, if you want to be super efficient, then threading is a way to go about this. You could always send the data asynchronously to the database once the server receives it in which case the user will see no impact to performance at all and the server will just hum along happily.
You can read this[^] to learn the basics of threading in C#


进行异步调用以在DB上保存数据

链接: C#中的异步调用
Make asynchronous call to save data at DB
Link :Asynchronous Call in C#


这篇关于网络聊天应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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