Connecting Directly to Appium Hosts in Distributed Environments
This edition of Appium Pro is in many means the sequel to the early clause on. In that article, we saw one way of have around network latency, by combining many Appium commands into one network request to the Appium server. When using a cloud service, however, there might be other network-related topic to worry approximately. Many cloud services adopt the standard Webdriver/Appium client/server model for running Appium tests. But because they host hundreds or thousands of devices, they & # x27; ll be lead a very high number of Appium servers. To reduce complexity for their users, they often provide a individual entry point for starting sessions. The users & # x27; request all come to this single entry point, and they are proxied on to the appropriate Appium server ground on the user & # x27; s authentication detail and the session ID. In these scenarios, the single entry point acts as a kind of Appium load balancer, as in the diagram below: This poser is great for making it easy for exploiter to connect to the service. But it & # x27; s not necessarily so outstanding from a test performance perspective, because it frame an additional HTTP request/response in between your test client and the Appium server which is finally handling your client & # x27; s commands. How big of a deal this is count on the physical organization of the cloud service. Some cloud keep their load balancers and devices all together within one physical datacenter. In that case, the extra HTTP call is not expensive, because it & # x27; s local to a datacenter. Other cloud provider emphasize geographical and net distribution, with real device on real networks scattered all over the reality. That latter scenario implies Appium serversalsoscattered around the world (since Appium servers must be scarper on horde physically connected to devices). So, if you want both the convenience of a single Appium endpoint for your exam book plus the benefit of a highly distributed gimmick cloud, you & # x27; ll be pay for it with a bunch of extra latency. Well, the Appium team truly doesn & # x27; t like unneeded latency, so we thought of a way to fix this small job, in the form of what we calldirect connectcapabilities. Whenever an Appium server last starting up a session, it send a reaction backwards to your Appium client, with a JSON object containing the capabilities the server provides (usually it & # x27; s just a copy of whatever capabilities you sent in with your session request). If a cloud service implements direct connect, it will add four new capabilities to that list: Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script. These capabilities will encode the locating and access information for anon-intermediaryAppium server -- the one actually handling your test. Now, your client had connected to the Appium shipment balancer, so it doesn & # x27; t know anything about the host and porthole of the non-intermediary Appium server. But these capabilities yield your client that info, and if your client also supports direct connect, it will parse these capabilities automatically, and control that each subsequent bid gets direct not to the load balancer but directly to the Appium server which is handling your session. At this point in time, the official Appium Ruby and Python libraries back direct connect, as well as WebdriverIO -- support for other clients arrive soon. It & # x27; s essentially what & # x27; s depicted in the diagram below, where for every command after the session initialization, HTTP request are made directly to the final Appium waiter, not to the load balancer: The nearly beautiful thing about this whole feature is that you don & # x27; t even need to cognise about direct connect for it to work! It & # x27; s a passive client feature that will work as long as the Appium cloud service you use has implemented it on their end as easily. And, because it & # x27; s a new characteristic all around, youmayhave to become on a flag in your client to signal that you need to use this feature if available. (For example, in WebdriverIO, you & # x27; ll need to add the enableDirectConnect option to your WebdriverIO config file or object.) But beyond this, it & # x27; s all automatic! The only other thing you might want to worry about is your corporate firewall -- if your security team has allowed connections explicitly to the shipment balancer through the firewall, but not to other hosts, then you may run into issues with commands being blocked by your firewall. In that lawsuit, either have your protection team update the firewall rules, or turn off direct connect so your commands don & # x27; t miscarry. To figure out the actual, practical benefit of direct connect, I again engaged in some experiment using HeadSpin & # x27; s device cloud (HeadSpin helped with implementing direct connect, and their cloud currently indorse it). Here & # x27; s what I found when, from my office in Vancouver, I ran a bunch of tests, with a cluster of commands, with and without unmediated connect, on devices sit in California and Japan (in all cases, the lading balancer was likewise located in California): What we see here is that, for tests I ran on devices in California, direct connect added simply marginal benefit. Itdidadd a fringy benefit with no downside, so it & # x27; s withal a nice little bump, but because Vancouver and California are pretty close, and because the load balancer was geographically quite close to the remote devices, we & # x27; re not gaining very much. Looking at the effects when the devices (and therefore Appium server) are located much further away, we see that direct connect provides a really substantial acceleration of about 30 %. This is because, without direct connect, each bid must travel from Vancouver to California and then on to Japan. With unmediated connect, we not only cut out the jobber in California, but we likewise avoid build another unhurt HTTP request along the way. (The way I ran these tests was basically the like as the way I ran tests for) You may not notice yourself in a position where you need to use direct connect, but if you & # x27; re a regular user of an Appium cloud supplier, make certain to ascertain in with them to ask whether they support the feature and whether your test situation might benefit from the use of it. Because the lineament needs to be enforce in the burden balancer itself, it & # x27; s not something that you can take advantage of by using open source Appium directly (although, it would be great if someone built support for direct connect as a Selenium Grid plugin!) Still, as use of devices locate around the world becomes more mutual, I & # x27; m felicitous that we have at least a partial solution for decimate any unneeded latency. Lead, Content Marketing, HeadSpin Inc. Piali is a dynamical and results-driven Content Marketing Specialist with 8+ years of experience in crafting engaging narratives and marketing collateral across diverse industries. She excels in collaborating with cross-functional teams to evolve innovative content strategies and deliver compelling, authentic, and impactful substance that resonates with target audience and enhances brand authenticity. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts..png)



Connecting Directly to Appium Hosts in Distributed Environments
AI-Powered Key Takeaways


Direct Connect in Action
Devices
Using Direct Connect?
Avg Test Time
Avg Command Time
Avg Speedup
Cali
No
72.53s
0.81s
Cali
Yes
71.62
0.80s
1.2%
Japan
No
102.03s
1.13s
Japan
Yes
70.83s
0.79s
30.6%
Analysis
Test Methodology
Conclusion
Piali Mazumdar
Connecting Directly to Appium Hosts in Distributed Environments
4 Parts
-1280X720-Final-2.jpg)
Regression Intelligence pragmatic guide for innovative exploiter (Part 3)
-1280X720-Final-2.jpg)
Regression Intelligence practical guide for innovative users (Part 4)
Discover how HeadSpin can authorise your business with superior testing capabilities







Discover how HeadSpin can indue your business with superior testing potentiality
Discover how HeadSpin can empower your job with superior screen capabilities
Connet Now


Automate This With SUSA
Test Your App Autonomously







.png)












