My colleague is using an application that consumes a lot of memory which makes the system too slow. Is it possible to share memory with other PCs over the Internet?
The system has 8 GB of RAM, and the application consumes more than 6 GB.
I've only considered a standalone application that runs on a "standard" machine with no ability to simply install it elsewhere or use specialist hardware or software. Other answers (correctly) address software migration or dedicated hardware for the task.
Any way to "share RAM" via a network will be subject to limitations of that network medium. As even gigabit Ethernet is limited to approximately 100MB/s (megabytes) this means that your "RAM" speed will be limited too.
100MB/s is a tiny fraction of the speed of the RAM that is actually in your system. Your program will be painfully slow and feel like it is running on a computer from the early 90's
Modern hard drives are, for sequential read and write, slightly faster than this. SSDs are several times faster.
This is ignoring latency problems which will make your program an order of magnitude slower again.
Due to the slowness and other technical issues involved this is a not an issue anyone has ever likely considered to be worth attempting to solve for "home" or "office" systems. It's cheaper and more effective to buy more RAM if it is needed.
Just buy more RAM, or even an SSD for a page file. There is no other way to do this that does not require an insane amount of work or hardware for little benefit.
Just for completeness: InfiniBand allows direct access to the memory of other machines.
However, it requires:
It does NOT work over an existing network, it requires a completely independent infrastructure for all connected nodes. It also does NOT work over the Internet
Is there any alternative solution?
This depends highly on the nature of the data.
You could run 2 different mysql servers on 2 different machines.
Then divide the data in 1/2 and write the program to automatically know which server to go to.
Of course this can be scaled to any number of servers if you have them available.
Yes, it's reasonably easy to do (and I've done this, for diskless systems needing swap), using Network Block Device protocol.
nbd-server on the server machine, and configure it to auto-create per-hosts files.
Ensure your client machines have NBD compiled into their kernels, and then configure them to swap to an NBD-mounted device. The
nbd-client package can help.
Sorry if the above is a little vague - The machines I've done this on are not reachable from here; I may be able to fill in the details when I have access to them.
There's an alternative NBD server implementation called
nbdkit; I don't know anything about it.
Given the small, unimportant details "Windows 10, workstation has 8G B RAM", there is really only one sane answer: Buy more RAM and run less crap.
Buying an SSD and putting the page file there would be the next best option, but really... buy more RAM.
Serving the page file ("share memory") over the network is of course possible, but it is a very bad idea. While it's true that there exist borderline cases where access time over network will be better than accessing a local drive, that's irrelevant for your usage case, because you need consistent low access time and high bandwidth at the same time. Remember, you're not anticipating one or two page faults, you're constantly swapping. Unless you are willing to pay a couple of thousands, there is no way you will be getting anywhere close to buying RAM or an SSD.
8 GB is not nearly enough to run Windows 10 and a memory-hungry application at the same time. It's barely enough for running Word, Excel and Outlook at the same time. That's exactly the typical completely unusable "total bullshit corporate setup" which millions of people have to live with every day on their work laptops. Invest 100-200 currency in another memory module, and it amortizes its cost within a week (things that took minutes now take seconds, and time is money -- unluckily this is often hard to get into the head of your local bean counter).
Alternatively, if you own the machine, you may use NTLite to cut down on the Windows 10 crap, reducing its memory footprint. Or, you might just turn off 80% of the mostly unnecessary services. It seems unbelievable, but it is possible to run a recent version of Windows with under 2 GB of RAM used.
But really, just buy RAM... it's so much faster and easier than spending hours of your precious time on cutting down the Windows crap.
A simple alternative would be to run the application on the remote PC, possibly under a dedicated user account, and simply control it via RDP, VNC or whatever is convenient.
Another option is to temporarily deploy the application in an environment where ram can be scaled up or down easily.
I'd look at an Amazon AWS instance, which can be changed in size with one reboot.
IE a small instance like a C5.large has 4GB ram and 2 cores, and costs $2.04 USD a day for linux, or $4.26 USD a day for a windows install. EBS disk space is an extra cost and scales linearly with GB allocated.
You can set up your system in this smaller size, and then when you want to go full noise, stop it, change the instance size, and run the software.
Or the biggest one...
https://www.ec2instances.info/ will help you pick a suitable size. Note some locations cost more than others. Singapore and Northern California are expensive. However your VM costs nothing when its not running, other than disk storage costs.
The downside is that if you need this memory for a long time, buying VM time is an expensive way to do it. However accountants seem to sometimes prefer operational costs like rental, to capital costs like upgrades.
As others have said it's technically possible but not worth it.
However if you want to speed up the use of your computer, it is possible to externalize some of your applications to a remote server.
This will mostly depend what you are working on and what application you use. If you are running programs that requires a lot of processing time for a small data output, you could make them run on a server different from your computer to save time and ressources while you work on something else.
The example I have in mind is a server that tests my code every time I push a modification. The idea with such a solution is that it is limited to specific use cases.
Ask IT to buy more RAM for your PC, and demonstrate the need using a screenshot of the app's usage in Task Manager.
There is a commercial solution for this, via a company called Kove (http://kove.net/). It requires an Infiniband infrastructure to work on the "backplane" (ethernet works normally), although other options like RoCE can sometimes be made available, depending upon specifics. They provide a number of transparent interfaces to allow zero code change integration, and APIs for kernel bypass with more direct CPU access (i.e., avoiding kernel overhead). In terms of performance, it depends on your application. If you are CPU bound, then the impact could be minimal (which can be surprising). If you are memory bandwidth bound on the local host, they'll give you larger memory, but you'll be throttled by the already existing bottleneck. In this case, is it advantageous to the workload to have larger memory than can be put in a box, and not run out of RAM? We have seen (very) good results with virtualization and python machine learning libraries. High end HPC applications tend to fair worse, but we have used the C APIs and managed to keep the performance hit acceptable while reducing node count (the nodes were there for the RAM, not the CPU cycles), which is a plus compared to MPI. Whether this is a good solution for your colleague is hard to tell, but it is an option you can look into. Hope that helps. To be clear, I do not work for Kove, and have no financial incentive, but I have collaborated with them for a number of years and think this technology has the potential to substantially impact the way certain computing is done.
Another point of view - maybe the problem isn't the limit on system resources, but the wasteful application your friend is writing. 6 GB of RAM is awful lot of memory.
Just because many of the other apps are overly bloated, does not necessarily means your friend application needs to be one of them. Using different programming methods can reduce memory requirements while improving speed. For example, if app loads whole dataset in memory and then works on it will be much more wasteful than for example storing data in (local or remote) SQL database with few select indexes and accessing it over there. Make it process data block-by-block if possible, instead of loading it all at once. In-memory structures could be wasteful too. Free memory when you're done with it. Do not load in into RAM what you can memory map instead. And hundreds of other tips...
If application however really needs more memory which needs to be stored on other computers, it can be modified to use memcached and the like to store it there. Bonus points as it will scale better in the future.
So the user asked for HOW to share memory over the network. Not if it is a good idea. So here is actually how you could do it.
I'm not saying this is a good idea, or will be performant, but it should work.
I'm assuming this isn't Windows Server where you could create an iSCSI mount point.
Computer 1 Steps:
Computer 2 steps:
Caveats - you may be able to skip the VHD nonsense if Windows lets you move the page file to the network share. There's not many examples of this online (for obvious reasons).
Complete system instability may occur, or something else entirely. Nobody really knows what would happen.
As you mention "RAM" for sharing over network not just "memory" of any kind, the final answer will be theoretically yes, practically no.
While other types of memory like storage and other temporary data is regularly shared over the network for various purposes and reasons. In the same way RAM can be technically possible to shared over network if needed. But the performance and cost will be too high to feasible in the real world.
The RAM or random access memory is used by an operating system as working space so lots of read / write operations are performed on it. On average system, data speed capacity with RAM is highest compared to other parts. If you put RAM on a network, you need to have very high speed data transfer capacity and cost will be sky high even if possible to achieve technically. With a tiny part of cost for a network speed upgrade you will get RAM for your machine locally.
Applications typically run in virtual memory, so their virtual memory requirement can exceed the available physical memory of the system with no consequence other than performance. The operating system will simply page virtual memory out to disk to free up physical memory as needed in any given moment for active use. This usually works just fine for applications which have reasonable locality (activity at any given time is somewhat focused to limited areas in the application's virtual memory space). If an application has poor locality (constantly referencing memory all over its virtual space), it will perform poorly unless all of its virtual memory can be accommodated in physical memory (all its virtual memory is resident).
So, there are a few possibilities here:
The idea of using memory on a remote computer is basically creating a networked paging file. In theory, it can work, but in practice, performance will be far better if the paging file was local to the computer (its own hard drive) because of network bandwidth and latency. It doesn't matter if the remote system is hosting the paging file in its memory or on its disk, the bottleneck (most significant limiter of performance) will be the network. This will be especially true over the internet, but will also be true even if the remote computer is adjacent on the same LAN.
This really depends on what type of application it is and for what the ram is used.
For example many web applications can use RAM over the network by connecting to a
memcached server. This will allow to store cache data (and other data which should be fast to access) on another computer with a lot of RAM.
Of course this is application specific and needs an application which can use memcached. This won't help you to open a second instance of slack as a browser does not support using such a cache backend.
Instead of sharing the RAM, Just code that application to create a child .exe file, that will be run on the Network PC and do the same on that pc.