Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

Make asynchronous call to save data at DB
Link :Asynchronous Call in C#
 
Share this answer
 
v2
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#
 
Share this answer
 
Comments
Abhinav S 21-Jan-13 10:31am    
Neat answer. 5.
fjdiewornncalwe 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.
fjdiewornncalwe 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 23-Jan-13 2:00am    
Thanks for your replay.now wouldn't affect user performance while saving chat log to db

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900