How to simulate slowness (pc or network) to find problems in code. lazarus / 21-General ---------------------------------------------------------------------- Hansvb · 2026-02-23 19:37 Hi, How could I imitate the following. Today I put the beginning of a tool on my work pc. The tool creates a SQlite database and places it on the network. No more than some empty tables and pragma settings. I have been doing this for some time in more or less the same way on my private pc. Today I found out through a slow network that I open and close a connection unnecessarily during the database creation. I often saw a wall file appear and disappear again. (For the first time, a slow network is useful ). How could I simulate that "slowness" in the code on my own laptop? There I never noticed that I open and close too often while creating a empty sqlite database file. ---------------------------------------------------------------------- Martin_fr · 2026-02-23 20:06 Well, if you "know" (have an inkling) what may be called to often... Either put "writeln" there, or breakpoints. Breakpoints don't need to stop (properties, un-check "break"), they can just count. Or take snapshots (takes a bit of time), then you can later look at stacks for each hit (view > debug windows > history). Of course if you suspect timeouts in a library/driver/... then you need to slow your app. Put a "sleep(500)" in OnIdle. Or better in an "ASyncHandler": Application.QueueAsyncCall(); => and inside the handler, always queue the next async call. ... Mind, I am not sure if that works in 4.4 or if you need trunk. I.e. if a newly queued Async call will let other work run, before the next async is handled. ---------------------------------------------------------------------- jamie · 2026-02-23 22:05 What is a "Wall File" ? here it's an organizer hanging on the wall that holds notes, file folders etc. Jamie ---------------------------------------------------------------------- 440bx · 2026-02-23 22:13 Another way of simulating a slow machine is to use a VM configured with only 1 processor and a limited amount of memory.  It's quite possible you can also configure the NIC used by the VM to be a 1mb/s device instead of 100mb, that should give you a slow network in addition to a slow machine. It has the advantage that it doesn't require any changes in the code.  A disadvantage will likely be that it will test your patience. ---------------------------------------------------------------------- cdbc · 2026-02-24 05:35 Hi Hmmm, I've been pondering over a "Transaction Sequencer", maybe I should do somthing about it  ...for reals I mean  The idea being, to kind of /pool/ your different 'Actions/operations' together in a sequence and then, when ready -- Execute the sequence in one fell swoop. These OPs could easily be DB-transactions  ...I think  · Open db-trax -> Execute sequence -> Commit db-trax -> Return collective success. ...I dunno - just spit-balling here  Regards Benny eta: Maybe a 'Priority Queue' ?!? eta2: Maybe 'Kiosk-mode' ?!? eta3: Hells Bells, or Heureka -- Look in the Diary app, that BOM has something similar implemented (Delta), it's just turned off there ---------------------------------------------------------------------- H₂SO₄ · 2026-02-24 05:57 Quote from: jamie on February 23, 2026, 11:05:21 pmWhat is a "Wall File" ? here it's an organizer hanging on the wall that holds notes, file folders etc. Write-ahead logging (WAL) is one of SQLite3's journaling modes; e.g. setting  pragma journal_mode=wal  on  Customers.db  causes a file called  Customers.db-wal  to appear when modifying the database. ---------------------------------------------------------------------- LeP · 2026-02-24 08:15 Quote from: Hansvb on February 23, 2026, 08:37:04 pmHi, How could I imitate the following. Today I put the beginning of a tool on my work pc. The tool creates a SQlite database and places it on the network. No more than some empty tables and pragma settings. I have been doing this for some time in more or less the same way on my private pc. Today I found out through a slow network that I open and close a connection unnecessarily during the database creation. I often saw a wall file appear and disappear again. (For the first time, a slow network is useful ). How could I simulate that "slowness" in the code on my own laptop? There I never noticed that I open and close too often while creating a empty sqlite database file. The network can be setting to lower rate with control panel in Windows (and in others SO is the same with thier tools). To slow down your application, you can use the affinity mask to let it use only one Core (or Thread if you are in a HyperThreading system). This can be done directly via Task Manager in Windows, but it's very simple to do in code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   SetProcessAffinityMask(GetCurrentProcess, $1); //Use only the first Thread / Core ---------------------------------------------------------------------- Warfley · 2026-02-24 09:57 Take a look at containernet, it allows you to spin up multiple docker containers and simulate network traffic with delay, jitter and package loss between them. Just deploy your client application in one container and your server in another and connect them with limited bandwidth and high delay to simulate a slow network Alternatively if you need to run the application natively check out mininet, which containernet is based on. This will give you virtual network interfaces you can bind your application to to simulate network traffic