Windows as a file server for Linux machines with apache + php

RUDI BR 21 Reputation points

I've recently been tasked to resolve an issue with an array of servers. The layout is several linux machines running apache + php (load balancer/auto scale), and they read all files, php session files and application files, from a network shared windows machine (using SAMBA).

Some of the session files are being deleted without notice or apparent cause, as users go about using the system. This happens a lot when there are concurrent requests that access and write to the same session file.

I'm sorry for the broad question, but I'm out my confort zone here. What kind of settings should I look to configure on the windows machine? It doesn't look like any aditional configuration was made on this machine to make it act properly as a file server. Any advice on basic docs and best practices is welcome.

Windows Server Storage
Windows Server Storage
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Storage: The hardware and software system used to retain data for subsequent retrieval.
592 questions
0 comments No comments
{count} votes

Accepted answer
  1. Mico Mi 1,916 Reputation points

    Do you mean the linux machines use SAMBA to read files from a windows server? If there’s any misunderstanding, please feel free to feedback.
    I found some docs about the lock and oplock settings of SAMBA and these settings could cause issues in some cases:

    One thing to remember about locking and Samba is that locks taken out by SMB clients will not generally effect or be detectable by Unix programs or NFS clients. This means that data corruption can still happen if Unix and Windows programs open the same file, or if the same NFS exported directory is shared by two different Samba servers.

    Oplocks is by default set to “on” by Samba on all configured shares, so careful attention should be given to each case to determine if the potential benefit is worth the potential for delays.
    If a client session has been caching writes and reads locally due to oplocks, it is likely that the data will be lost when the application restarts or recovers from the TCP interrupt.
    Unless your system supports kernel oplocks, you should disable oplocks if you are accessing the same files from both UNIX/Linux and SMB clients. Regardless, oplocks should always be disabled if you are sharing a database file (e.g., Microsoft Access) between multiple clients, because any break the first client receives will affect synchronization of the entire file (not just the single record), which will result in a noticeable performance impairment and, more likely, problems accessing the database in the first place.
    Maybe these docs can give you some directions to check the lock and oplock settings.

    Thanks for your time!
    Best Regards,
    Mico Mi

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful