gurpal2000
gurpal2000

Reputation: 1082

Routine to force kdb into a bad state for testing purpose?

Can someone recommend a quick way to:

I haven't anything because I simply don't know.

This is to aid monitoring and testing.

thanks

Upvotes: 1

Views: 110

Answers (3)

Darren
Darren

Reputation: 549

For testing purposes you might want to do this via IPC.

  • Could you simulate filling up kdb memory can be done by setting -w command line option? The result is the same as far as kdb is concerned.

When you are looking to simulate slow performance, are you looking to simulate slow calculation or slow response?

  • If slow calculation, you could put some kind of loop in front of a function:

    myFunc:{(x+y)*2 xexp 30}
    mySlowFunc: ('[;]) over ({system "sleep 1"; x[0] . x[1]};(myFunc;);enlist)
    \ts show myFunc[1;2]
    3.221225e+09
    0 4194720
    
    \ts show mySlowFunc[1;2]
    3.221225e+09
    1002 4194752
  • If slow response, you could look at hijacking the command with -30! and then running the response action on a timer.

Upvotes: 0

terrylynch
terrylynch

Reputation: 13657

You could simulate memory filling by running the process with a very small memory limit and create a very large table to fill up memory.

You could simulate slow/sluggish behaviour by overriding the message and input handlers to do something slow:

.z.pi:.z.ps:.z.pg:{do[100000;til 10000];0N!value x}

Upvotes: 1

Callum Biggs
Callum Biggs

Reputation: 1540

To fill up the memory just create a very large list

q)til 10000000000
'wsfull

To get slow performance is trickier, you could restrict the taskset and have two kdb processes, where one of them has something on a timer that computationally intensive. The other kdb process will then be getting reduce computational power.

.z.ts:{asc 1000000000?100.0}
\t 100

Upvotes: 1

Related Questions