<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>SmartDukaan &#x2013; /trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/BrowserLane.java</title><description>WebSVN RSS feed &#x2013; SmartDukaan</description><lastBuildDate>Thu, 01 Oct 2026 15:33:50 +0530</lastBuildDate><generator>WebSVN 2.8.6-DEV</generator><language>en</language><link>https://svn.smartdukaan.com/log.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-common%2Fsrc%2Fmain%2Fjava%2Fcom%2Fspice%2Fprofitmandi%2Fcommon%2Futil%2FBrowserLane.java&amp;max=40&amp;</link><atom:link href="https://svn.smartdukaan.com/rss.php?path=%2Ftrunk%2Fprofitmandi-common%2Fsrc%2Fmain%2Fjava%2Fcom%2Fspice%2Fprofitmandi%2Fcommon%2Futil%2FBrowserLane.java&amp;repname=SmartDukaan" rel="self" type="application/rss+xml" />
<item><pubDate>Thu, 17 Sep 2026 13:12:56 +0530</pubDate><dc:creator>amit</dc:creator><title>Rev 37672 – Add BrowserLane: machine-wide interlock so only one headless Chrome runs ...</title><description>&lt;div&gt;&lt;strong&gt;amit – 1 file(s) modified&lt;/strong&gt;&lt;br/&gt;Add BrowserLane: machine-wide interlock so only one headless Chrome runs at a time&lt;br /&gt;
&lt;br /&gt;
Every ChromeDriver tree on the app box costs ~850MB RSS, on a host holding a&lt;br /&gt;
-Xmx8g tomcat and a -Xmx2g cron jar on 16GB that has been kernel-OOM-killed&lt;br /&gt;
twice with tomcat the victim. Peak concurrent drivers is the number that&lt;br /&gt;
matters, not drivers per day.&lt;br /&gt;
&lt;br /&gt;
Measured on the oppo/realme lane: a 25-imei chunk takes 505s (12s driver&lt;br /&gt;
startup, then ~19.7s an imei) against a fixed 20s fixedDelay, i.e. a 96% duty&lt;br /&gt;
cycle. Meanwhile tomcat starts its own driver 8 times a day for the knowlarity&lt;br /&gt;
scrape. On 17-Sep that scrape ran 11:40:00-11:41:07 and the lane&apos;s next driver&lt;br /&gt;
came up at 11:42:21 -- it cleared by 74 seconds, by luck. At a 96% duty cycle&lt;br /&gt;
the collision cannot be dodged by choosing better times, only by serialising.&lt;br /&gt;
&lt;br /&gt;
The two JVMs are separate processes owned by different users, so an in-process&lt;br /&gt;
flag cannot see across the boundary. Uses an OS file lock at&lt;br /&gt;
/var/lock/sd-browser.lock (overridable via -Dsd.browser.lock), created 0666 on&lt;br /&gt;
first use because cron runs as root and tomcat as tomcat and whichever starts&lt;br /&gt;
first creates it. A file lock rather than a marker file so the kernel reclaims&lt;br /&gt;
it when the holder dies: verified by SIGKILLing the holder mid-hold, the next&lt;br /&gt;
JVM acquired in 264ms. A ReentrantLock gates it first, since a second thread in&lt;br /&gt;
the same JVM would otherwise get OverlappingFileLockException rather than block.&lt;br /&gt;
&lt;br /&gt;
Callers wait rather than skip. The knowlarity scrape needs 67s against a lane&lt;br /&gt;
busy 96% of the time, so skip-on-contention would mean it essentially never&lt;br /&gt;
refreshed again. Eight scrapes a day costs the imei lane about nine minutes of&lt;br /&gt;
waiting in total.&lt;br /&gt;
&lt;br /&gt;
Fails open if the lock file is unusable (missing /var/lock, read-only mount, dev&lt;br /&gt;
laptop): serialising within the JVM only, rather than stopping imei activation&lt;br /&gt;
over what is a safety interlock.&lt;/div&gt;+ /trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/util/BrowserLane.java&lt;br /&gt;</description><link>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-common%2Fsrc%2Fmain%2Fjava%2Fcom%2Fspice%2Fprofitmandi%2Fcommon%2Futil%2FBrowserLane.java&amp;rev=37672</link><guid>https://svn.smartdukaan.com/revision.php?repname=SmartDukaan&amp;path=%2Ftrunk%2Fprofitmandi-common%2Fsrc%2Fmain%2Fjava%2Fcom%2Fspice%2Fprofitmandi%2Fcommon%2Futil%2FBrowserLane.java&amp;rev=37672</guid></item>
</channel></rss>