48

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.

  • 5
    Run it on a high-powered server via Remote Desktop, or VNC, or X11 ?? – WGroleau Feb 23 '18 at 5:19
  • 3
    You're better off using large storage drives (HDDs or SSDs) as cache, as answers mentioned already. – Firebug Feb 23 '18 at 16:34
  • 12
  • 78
    You might have more luck downloading more RAM... – Mehrdad Feb 24 '18 at 5:44
  • 4
    Modern versions of windows allow you to use USB sticks or SD cards to improve performance. Does not actually mean that the device is used as RAM but something that performs between RAM and platter based hard drive. – Salman A Feb 24 '18 at 15:28

16 Answers 16

160

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.

  • 46
    Swapping / paging over gigabit ethernet can have lower latency than a pagefile on a local magnetic disk. e.g. 10 ms disk latency vs. well under 1ms ping time for local ethernet. If the file server holding the pagefile (or iSCSI device you're swapping to) keeps it hot in its RAM, you potentially win. IDK if Windows supports paging to a network file. (I'm pretty sure Linux does, but this is a Windows question). Oh, just saw that the question says "over the Internet", so nvm. – Peter Cordes Feb 22 '18 at 21:39
  • 2
    @MarkHu Given this was asked on Super User, I don't think the asker has any control over the code of the software being used. – oldmud0 Feb 22 '18 at 21:40
  • 2
    @PeterCordes What you describe is still a loss over buying more RAM or an SSD. And even more certainly so in Windows. ;) – jpmc26 Feb 23 '18 at 7:47
  • 11
    @TomTom for home and "normal" office use gigabit is still pretty much what you get at your desktop machine. Just because 25G and 100G are common (or at least availbale) for backbone infrastructure does not mean you are likely to see it on the desktop. I can't even find a desktop 10GigE card at any local supplier at a reasonable cost, let alone a 25GigE. 10GigE cards are about 4 times the cost of an 8GB memory stick here. I know which I'd consider a reasonable upgrade. – Mokubai Feb 23 '18 at 21:21
  • 9
    "feel like it is running on a computer from the early 90's" — strange, computers from the 90s felt much faster than computers feel today. – Jeremy Visser Feb 23 '18 at 22:22
73

Just for completeness: InfiniBand allows direct access to the memory of other machines.

However, it requires:

  • An InfiniBand switch
  • A InfiniBand add on card in each machine
  • The application has to be programmed specifically to use this

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

  • 53
    It is also certainly a lot more expensive than just getting another 8 GiB or so of RAM :-). – sleske Feb 22 '18 at 14:55
  • 40
    Oh, only by one order of magnitude or so ;) – Gerald Schneider Feb 22 '18 at 14:57
  • 7
    You don't need infiniband, RoCE is also possible. However, this does require NICs that support RDMA and probably a new switch to support the NICs, and an application programmed to use RDMA. – alex.forencich Feb 22 '18 at 19:48
  • 7
    +1 because it is a great and correct but -- for this situation -- totally useless answer :-) – daniel.neumann Feb 22 '18 at 21:39
  • 1
    You do - unless you get 25G or 100G which are more expensive. RDMA does not solve the latency issue. – TomTom Feb 23 '18 at 21:09
18
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.

  • I had considered mentioning that generally the way that we "share memory" is by actively moving the application to another machine and then working with it remotely via whatever methods are available. It is definitely an alternative to buying more memory, especially if another machine is already available. +1 – Mokubai Feb 22 '18 at 14:13
  • 1
    Like a remote desktop? – Innov Feb 22 '18 at 15:47
  • 4
    You have 2 computers running separate OS, and each one has a copy of mysql running. So computer #1 could be 192.168.0.1 and computer #2 192.168.0.2 (or whatever.) On your main PC you can now to both of those IP to retrieve your data. Mysql or its free replacement mariadb offers libraries like libmysql to add to your program so it has native access to mysql. This is not a remote desktop, its client-server and/or client and multiple server relationship. – cybernard Feb 22 '18 at 16:54
15

Yes, it's reasonably easy to do (and I've done this, for diskless systems needing swap), using Network Block Device protocol.

Install 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.

  • I've just spotted that the question has a Windows tag. I don't know anything about Windows - sorry. – Toby Speight Feb 22 '18 at 17:38
  • 8
    +1, swapping over GigE on a LAN should be lower latency than a local magnetic hard driver, if the file-server you're swapping to keeps the swap file cached in its RAM. HD seek times of ~10ms vs. LAN ping times of ~0.25 ms. No idea if Windows can do anything similar e.g. with a page file over Windows File Sharing (SMB) or any other protocol, but maybe iSCSI could work. The OP mentions "over the Internet"; that wouldn't be a good idea. Unless your ping time is lower than your HD random-access latency, it's not a win. – Peter Cordes Feb 22 '18 at 21:45
  • I don't see how this qualifies as "additional RAM". It's no different than dumping some data to a file on a local disk, no? – ivan_pozdeev Feb 25 '18 at 7:50
  • For a Wndows client, one can share a block device in Linux via Samba and mount it as a disk in Windows with ImDisk (size will need to be specified manually). – ivan_pozdeev Feb 25 '18 at 7:51
  • i've also done this in the past on Linux, although i used my own nbd server-client implementation, it worked fine to use the nbd block device as a swap partition. – hanshenrik Feb 25 '18 at 13:14
9

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.

  • 2
    Is windows really that bad on ram? I'm running Debian with the complete system in ram (no physical drive) and can have dozens of open web browser tabs, LibreOffice text & spreadsheets, gimp photo editing, and watch a video or listen to music, leaving about 3 gigs of free space for programs or files, all on 8GB total. I'm not a win-hater, but from your words the "total BS corporate setup" sounds a lot like windows itself... – Xen2050 Feb 23 '18 at 19:10
  • 1
    Well, that is disputable - the OP has it right. LAst time I purchased 8gb machiens was around 2010. This is 2017. Applications using 16gb memory are not that rare in certain fields (hint: not writing emails and no, word is also fine, most people do not write novels on it). This is a small investment - 16gb memory is a freaking lunch or something. – TomTom Feb 23 '18 at 21:14
  • 7
    @Xen2050 I was wondering if it is really that bad, so on my 6GB Windows 10 machine I opened Outlook, Excel, Word, Edge, I've got a very small instance of SQL Server running, Malwarebytes seems to be doing something with 170MB, I opened Visual Studio 2017, I've got Firefox open here, and I'm at 65% memory use and Windows has not even had to start using compressed memory. So, IME, Windows 10 runs fine with less than 8GB of RAM and, anyway, Damon's apparent dislike of Windows is irrelevant to the answer. – Andrew Morton Feb 24 '18 at 17:56
  • 1
    @Damon: But unless you did some sort of analysis on what was consuming the extra RAM, there's no basis for blaming it on "the Windows crap" vs "the aftermarket crap installed by the employer". Since plenty of people (including myself) have done memory-intensive calculations, on Windows 7, Windows 8.x, and Windows 10, without that kind of issue, it strongly suggests (but does not prove) that the culprit isn't part of Windows itself. – Ben Voigt Feb 26 '18 at 14:54
6

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.

  • If the remote PC has enough ram... – LateralTerminal Feb 23 '18 at 18:08
  • 1
    @LateralTerminal That's implied. – Clonkex Feb 27 '18 at 4:28
  • 2
    Yeah, merging the RAM of two machines over a network ... net won't work, not for ordinary applications (the square, grey kind with buttons and menus). – rackandboneman Feb 27 '18 at 11:10
6

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.

  • m5.4xlarge is 64 GB ram and 16 cores, for $18.44 USD/day or $36.10 USD/day for windows.
  • r4.8xlarge is 244 GB and 32 cores, for $51.07 USD/day or $86.40 USD/day with windows.
  • x1.32xlarge is 1952 GB and 128 cores, for $320.12 USD/day or $461.43/day with windows

Or the biggest one...

  • x1e.32xlarge is 3904 GB and 128 cores, for $640.52 USD/day or $781.82/day with windows. If your colleague needs more than this then the problem needs rewriting in a more-optimal way.

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.

  • 1
    I realise that this answer isn't addressing "accessing ram over the network" as per OP's request. It is more like accessing a remote host which has more ram. However knowing how budgets work in some places this may be a valid solution to get the job done in a fundable way. – Criggie Feb 26 '18 at 2:28
4

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.

4

Ask IT to buy more RAM for your PC, and demonstrate the need using a screenshot of the app's usage in Task Manager.

  • 4
    Practical solution... even asking IT to temporarily swap in more ram from other systems should be a "free" answer. – Xen2050 Feb 23 '18 at 19:11
  • 2
    @Xen2050 Meanwhile you colleague is crying because his system no longer boots. – Willtech Feb 24 '18 at 9:46
  • 3
    @Willtech it's normal and proper for IT to maintain spares of all parts, and spares of whole working systems. Downtime is the real cost. – Christopher Hostage Feb 24 '18 at 17:11
3

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.

  • Howmany Gigabytes of memory can you buy for the infinityband setup? – joojaa Feb 23 '18 at 20:39
  • Yeah, the main issue here is the little point that he talks about having 8gb memory only and needing 16. This is not "How do I use remote ram" but "why the heck do I use a system that has 10 year old specs". – TomTom Feb 23 '18 at 21:12
  • @jooja We have 6TB. Based on what we have seen, we haven't seen a limit. You can keep adding additional remote RAM appliances. It seems to scale fairly linearly, so it is an engineering/cost problem. We designed a 1PB system once on paper, but obviously couldn't field that to test it. – Bill Feb 24 '18 at 2:56
  • @TomTom I didn't see the comment about 8GB, but yes, clearly if we are talking 8GB vs. 16GB of RAM, a few $K for a new machine will solve the problem. – Bill Feb 24 '18 at 2:58
  • Heck, for a few $hundred, you can probably upgrade the RAM to 32GB, unless the motherboard is ridiculously old and limited. – fluffy Feb 24 '18 at 9:29
2

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.

  • 5
    6gb of memory is not an awful lot depending on application. Even end users do photo editing (photoshop loves RAM and a high end camera shoots 64 megapixel images), Video Editing (MUCH worse), then there is mathematical work. Heck, even excel will gladly use a couple of GB. Not everyone is writing emails, using twitter and other such things. – TomTom Feb 24 '18 at 9:59
  • @TomTom if you need high megapixel processing, you will be having high memory requirements (by nature of the request). But unless you're doing DNA genome splicing in your Excel sheet and it is still using a couple of GB RAM, that it is exactly the kind of bloat and sloppy programming that I'm talking about. You know, like, your home budget was happily being processed as fast (or faster) in Lotus 1-2-3 few decades ago on machines with 3 orders of magnitude less RAM (and at least hundreds of times slower processors) than your Excel of today. – Matija Nalis Feb 25 '18 at 4:03
  • 1
    Whow, what an ignorant anser. I can only assume you have very little experience with what people use excel for. WHen Microsoft made the 64 bit version of Office they said there is little use for it - EXCEPT for Access and Excel as there are some people (mostly managers) running brutally large analysis via Excel, using up many gigabytes of memory. The flexibility of Excel and the approachability for non-programmers makes it their go to tool (statisticians tend to be trained in using R). I have personally seen 200 sheet excel files by some finance people. – TomTom Feb 25 '18 at 11:38
  • If your home budget takes a long time to calculate in Excel, you're a lot richer than I am. Interesting question on Excel vs 1-2-3 - the core calc loop may well be faster in 1-2-3 because it doesn't do as much. But on a multi-core machine, Excel will easily beat 1-2-3. And obviously the gigantic genome splicing sheets probably won't open in 1-2-3 because of the sheet sizes. In the interests of transparency, I ought to admit that I formerly worked on Excel on the core calc team, so I may be biased... – Chris Rae Feb 25 '18 at 17:51
1

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.

  • Computer 1 = "master" - where code is executed
  • Computer 2 = "child" - memory donator

I'm assuming this isn't Windows Server where you could create an iSCSI mount point.

Computer 1 Steps:

  1. Download Dataram's free ramdisk: http://memory.dataram.com/products-and-services/software/ramdisk
  2. Create a ramdisk and format it with NTFS - instructions are available on their site
  3. Within Disk Manager, create a VHD file on the ramdisk formatted with NTFS
  4. Share the Ramdisk root directory across the network with SMB - Right click the drive, share, share this folder

Computer 2 steps:

  1. Map the shared drive from the cild onto a Drive
  2. Mount the VHD you created in step 3 above in Disk manager
  3. Move the local page file location to the mounted VHD via Move Windows Page File
  4. Remove any other page file entries.

Done!

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.

0

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.

0

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:

  • If the application simply has a large footprint but good locality, you should be able to run it on the computer you have available; performance may be acceptable, may or may not noticeably improve on a computer having more memory.
  • If it has poor locality, you may find that it will run on the available computer anyway, just very poorly. (This seems to be the case for you)
  • Upgrade the (assumed) magnetic disk drive to a solid state drive (they are significantly faster)
  • Add memory to the computer you have available (if possible)
  • You may need to find a computer which has more memory and run it on that.
  • Improve the application so that it either has a smaller virtual footprint or better locality (if you are or are in association with the author of the application).

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.

  • Windows will not allow a pagefile on a network drive, so even if it would be fast enough, it just can 't be done. – Jamie Hanrahan Feb 25 '18 at 2:04
  • @JamieHanrahan Apparently, you can if you change the setting directly in registry. I wonder if they excluded some details though since network drives are per-user in Windows. I also suspect this will break after a reboot. – ivan_pozdeev Feb 25 '18 at 8:12
  • 1
    Nevertheless it's a terrible idea, which is why the UI precludes it. Network connections are not reliable enough to trust for paging. Remember that much kernel data (paged pool) can be paged. If it's not accessible, even for a very short time, the OS will crash. – Jamie Hanrahan Feb 28 '18 at 12:20
0

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.

-1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.