Click here to Skip to main content
12,746,681 members (28,965 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET
i developed a chat application using SignalR and integrate in 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?

Posted 21-Jan-13 2:05am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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#
Abhinav S 21-Jan-13 10:31am
Neat answer. 5.
Marcus Kramer 21-Jan-13 11:14am
Thanks, Abhinav
binusn 22-Jan-13 0:28am
Hi Marcus
Thanks for replay.
U mean no need to use thread for this scenario.My concern is more than 100 people at a time using this chat application.Now am not implementing chat log saving to database.Now performance is OK. Am not sure how to affect user performance while saving data. That's why i asked to u.
binusn 23-Jan-13 2:00am
Thanks for your wouldn't affect user performance while saving chat log to db
Marcus Kramer 23-Jan-13 8:49am
Like any application, whether threaded or not, load will have some impact on application performance, but that will be more to do with infrastructure and bandwidth than with the application itself.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Make asynchronous call to save data at DB
Link :Asynchronous Call in C#

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170215.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100