[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternative Hashtbl and lwt yield-like functionality questions



On Wed, Dec 14, 2011 at 12:49 PM, Haris Rotsos <cr409@xxxxxxxxxxxx> wrote:
> Hi all,
>
> As the mail tittle suggests, I am sending this mail to ask some
> ocaml-oriented question.
>
> Firstly, I am writing a regression test for mirage in which I need to
> store a large number of entries in an Hash table. The test will create
> unique entries in the table with a rate of  ~70K netries per second.
> My experiment so far shows that the performance of the Hashtbl
> insertions start to drop after a few seconds, as the memory management
> will start to consume cycles in order to allocate new buckets and
> possible rearrange the the distribution of the hashed values. The key
> I am using is a record of a string and a 64bit int. The string
> represents a mac address. Is any one aware of some other ocaml module
> that could satisfy the basic requirements of a hash table and would
> possible scale to large numbers of insertions?

Not an expert there. I know there are regular exchange on the mailing
list about Hashtables and such. Maybe looking at the archive might
helpâ

>
> Secondly, I am currently using the lwt threading mechanism in order to
> handle all the asynvronous functionality of my code. I have a minor
> problem with the scheduler though as it tends to stick with a single
> thread during a test and doesn't schedule any other as long as it has
> data to process. Can somebody more experienced with lwt point me some
> calls or configuration parameters that would allow either a thread to
> yield explicitly, or implement a more fair scheduling policy.

Lwt_unix.yield yields.

If you are running in mirage (as I suspect you do) you can use
Os.Time.sleep with 0. as argument (in the standard Lwt (and all the
versions I know of) yield is just "sleep 0.").

Ideally you can just make the function available through the interface
file time.mli since it is already defined in time.ml.


-- 
_______
Raphael



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.