Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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
Posted 21-Jan-13 2:05am
binusn693
Rate this: bad
good
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#
  Permalink  
Comments
Abhinav S at 21-Jan-13 10:31am
   
Neat answer. 5.
Marcus Kramer at 21-Jan-13 11:14am
   
Thanks, Abhinav
binusn at 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.
Marcus Kramer at 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.
binusn at 23-Jan-13 2:00am
   
Thanks for your replay.now wouldn't affect user performance while saving chat log to db
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

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

  Print Answers RSS
0 Maciej Los 295
1 OriginalGriff 249
2 Sergey Alexandrovich Kryukov 205
3 Aajmot Sk 197
4 Sinisa Hajnal 176
0 OriginalGriff 7,800
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2014
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