简体   繁体   English

Hilo在c#console app中使用nhibernate

[英]Hilo in c# console app with nhibernate

Having a console app which which many will start over and over again and using hilo. 有一个控制台应用程序,许多人将一遍又一遍地开始使用希洛。 Everytime the app is started and the sessionfactory is rebuilt the hilo columns (next_hi) will be increased and a reserved space with ids will be lost. 每次启动应用程序并重建sessionfactory时,hilo列(next_hi)将增加,并且带有id的保留空间将丢失。

Have anybody had any experience with this? 有没有人有这方面的经验?

Could't that be a nice feature for the hilo-generator to optionally remember the high and low-values for applications often being shutdown by many users? 对于hilo-generator而言,这可能是一个很好的功能,可以选择性地记住许多用户常常关闭的应用程序的高值和低值? I mean it have already reserved a space of ids, which in that environment often isn't fully utilized. 我的意思是它已经预留了一个id的空间,在那个环境中往往没有得到充分利用。

Thank you for sharing your experiences in advance! 感谢您提前分享您的经验!

Int64 max value is 9223372036854775807. Lets assume that each application start you will insert one record and lose 99 ids. Int64最大值为9223372036854775807.让我们假设每个应用程序启动时您将插入一条记录并丢失99个ID。 it means you have 9223372036854775807 / 100 = 92233720368547758 effective ids. 这意味着你有9223372036854775807/100 = 92233720368547758有效ID。

Lets assume you applications inserts 50000 records per second into database. 让我们假设您的应用程序每秒将50000条记录插入数据库。

92233720368547758 / 50000 = 184467440737095.51614 seconds = 2135039823.346012918287037037037 days = 5930666 years. 92233720368547758/50000 = 184467440737095.51614秒= 2135039823.346012918287037037037天= 5930666年。

Are you still worried? 你还担心吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM